Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions judge/typesafe/typesafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ const (
// empty.
EnvAPIKey = "TYPESAFE_API_KEY"

// EnvBaseURL and EnvModel are read when Config.BaseURL / Config.Model
// are empty — the same names TypeSafe's own SDKs honour, and what a
// gateway that speaks the TypeSafe shape asks you to set (Vercel AI
// Gateway: TYPESAFE_BASE_URL=https://ai-gateway.vercel.sh/typesafe,
// model typesafe-ai/jev, an AI Gateway key as the API key).
EnvBaseURL = "TYPESAFE_BASE_URL"
EnvModel = "TYPESAFE_MODEL"

// evaluatePath is the System One evaluation endpoint.
evaluatePath = "/v1/systemone"
)
Expand Down Expand Up @@ -135,6 +143,12 @@ func New(cfg Config) (*Judge, error) {
if key == "" {
key = os.Getenv(EnvAPIKey)
}
if cfg.BaseURL == "" {
cfg.BaseURL = os.Getenv(EnvBaseURL)
}
if cfg.Model == "" {
cfg.Model = os.Getenv(EnvModel)
}
if key == "" {
return nil, fmt.Errorf("typesafe: no API key: set Config.APIKey or %s", EnvAPIKey)
}
Expand Down
3 changes: 3 additions & 0 deletions pricing/systemone.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ var systemOnePrices = map[string]Price{
"jev-1.13.0": {InputPerMTok: 0.042, OutputPerMTok: 0},
"jev-latest": {InputPerMTok: 0.042, OutputPerMTok: 0},
"jev-preview": {InputPerMTok: 0.042, OutputPerMTok: 0},
// The same model as Vercel AI Gateway names it; the gateway adds no
// markup (vercel.com/ai-gateway/models/jev, read 2026-09-20).
"typesafe-ai/jev": {InputPerMTok: 0.042, OutputPerMTok: 0},
}

// lookupSystemOne resolves a model against the hand-maintained table.
Expand Down
Loading