diff --git a/judge/typesafe/typesafe.go b/judge/typesafe/typesafe.go index bdb6534..42c5155 100644 --- a/judge/typesafe/typesafe.go +++ b/judge/typesafe/typesafe.go @@ -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" ) @@ -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) } diff --git a/pricing/systemone.go b/pricing/systemone.go index acb7910..5488818 100644 --- a/pricing/systemone.go +++ b/pricing/systemone.go @@ -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.