Open History to see the last commit
1# API changes
2
3Non-additive changes to the catalog and estimate API. Package release
4steps stay in the README under "Releasing on npm". npm package changelogs
5are written by changesets.
6
7**Breaking:** `completeness` on `GET /v1/status` and `GET /v1/providers`
8scores every live model, not only chat (#714). `chat` is replaced by
9`rows` (live models scored), and the entry gains `activities` (per
10activity `{ rows, score, filled, needed }`, plus `unclassified` for a
11null activity) and `originLink` (`{ have, need }`). Image, video and audio
12rows are scored on `priced`, `endpoint`, `modalities` and
13`outputModalities`; a null activity counts as one missing fact; a model
14whose id another provider also lists needs an origin link. `score` is
15null only when nothing is scored, so an audio-only provider now has one.
16Scores are null until the first models poll after the deploy.
17
18**Changed (0.1.x):** model rows gain `aliasOf` (#709), and `aliases` can
19now name ids that are rows of their own. Mistral rows list their whole
20alias group, an OpenAI dated snapshot lists the undated alias that
21resolves to it, and a Gemini target lists its `-latest` alias. A lookup
22by an id that is a row still returns that row. Code that treated every
23`aliases` entry as "not a row" should check `aliasOf` instead.
24`factSources` gains `aliases` and `aliasOf` (README, "Aliases at the same
25provider"). Needs D1 migration `0019`: migrate first, then deploy.
26
27**Breaking:** `GET /v1/openapi/{provider}` has no `{path}#stream`
28operations. JSON and `text/event-stream` share one operation's `200`, and
29schemas live in `components.schemas` (every `$ref` resolves). hey-api
30clients lose typed streaming until hey-api/hey-api#4482 is fixed (README,
31"Generation OpenAPI").
32
33**Breaking (0.1.x):** `capabilities` is a map of booleans, not a list of
34flag names: `["tools", "reasoning"]` is now `{ "tools": true, "reasoning":
35true }`, and a flag the provider states the model does not support is
36`false`. Replace `capabilities.includes('tools')` with
37`capabilities?.tools === true`. A missing key is unknown, not `false`. The
38provider-native objects five providers kept in `capabilities` (fal
39`{ category }`, BytePlus, ElevenLabs, Replicate, Reactor) moved to the new
40`providerMetadata` field, so `capabilities` is a boolean map or `null` on
41every row. `?capability=` matches a flag set to `true` by exact name; it
42was a substring match over the stored JSON, so `?capability=text-to-image`
43(a fal category) no longer matches anything. Use `?activity=` or read
44`providerMetadata.category`.
45
46**Added (0.1.x):** model rows gain `releasedAt`, `knowledgeCutoff`,
47`openWeights`, `weightsUrl` and `providerMetadata`, all nullable
48(README, "Capability flags, dates and provider metadata").
49
50Both need D1 migrations `0013` (columns) and `0014` (stored capability
51lists become maps; native objects move to `provider_metadata`). Migrate
52first, then deploy: `pnpm run deploy:ci` does both in that order.
53
54**Breaking (0.1.x):** `reasoning.mode` gains `toggle` (an on/off thinking
55switch and nothing else), and `reasoning.mandatory` is `boolean | null`.
56`null` means the provider's source does not say whether thinking can be
57turned off. It must NOT be read as `false`: `if (!reasoning.mandatory)`
58now misreads it, so test `reasoning.mandatory === false` before offering
59an off option. `efforts` is never present on `toggle`, a `toggle` row
60always has a stated `mandatory`, and a `switch (mode)` needs a `toggle`
61case. `true` means the provider states thinking cannot be turned off —
62but rows written before this rule also store `true` when a level list
63merely has no `none`. Until those adapters are converted, treat `true` as
64"inferred" on `openai`, `vercel`, `amazon-bedrock` (effort rows),
65`mistral`, `groq`, `grok`, `moonshotai-cn`, `baseten`, `byteplus`,
66`fal`, and on the `effort` rows of `gemini` and `google-vertex`.
67
68**Breaking (0.1.x):** `models.pricing` is a RateCard or `null`, not an
69OpenRouter `{ prompt, completion, … }` blob. List rows carry a summary of
70the stored card — `{ per: 'token', inputPerMillion, outputPerMillion }` at
71the base rate (`tiered: true` when long prompts re-quote), or
72`{ per: 'second' | 'character' | 'image' | 'request' }` for a card billed
73by unit — so `null` on a list row always means no card. `GET
74/v1/models?pricing=1` and model detail return the full card, and
75`GET /v1/status` counts `priced` models per provider. Together all-zero placeholders are
76`null`. `POST /v1/estimate` evaluates a stored card.
77
78**Breaking (0.1.x):** `POST /v1/estimate` (and the MCP `estimate_cost`
79tool, and `estimateCost` in `@modelschemas/client`) can return a range
80(#406). A routed id whose routes bill different prices (LLM Gateway bare
81ids such as `gpt-oss-120b`) has `pricing: null` and a `pricingRange`:
82min/max per million over the routes' published cards, each route named by
83its own pinned row (`groq/gpt-oss-120b`). It is a bound, never the billed
84price. Estimating such a row prices the call on every route and returns
85`{ currency, min, max, routes }` instead of `{ amount, … }`; `min` and
86`max` each carry `model` (the route) and the usual result fields. A route
87with no card refuses the estimate. Check for `min` before reading
88`amount`. Vercel rows whose price varies by route (#346, #451) are
89`pricing: null` and, after the daily `/endpoints` extract, a
90`pricingRange` whose routes are Vercel `provider_name`s with the card
91inline. An endpoint with `status` other than 0 is omitted and named on
92`factSources.pricingRange` (`skipped status!=0`). It is not a catalog row.
93
94**Breaking (0.1.x):** `POST /v1/estimate` (and `estimate_cost`,
95`estimateCost`) has a third result shape (#450). When the call omits
96exactly one required choice input (an enum or boolean with no default,
97such as BytePlus `pricing_period: off_peak | peak`) and supplies every
98other required input, it returns `{ currency, byInput: { input, values }
99}`: one usual result per allowed value, keyed by value (`"true"`/`"false"`
100for a boolean). Supplying the input returns one result as before. Two
101omitted choices, or any omitted quantity, is still 422 `unbound_input`,
102now naming every omitted choice with its values. A routed id whose route
103hits this case refuses. Check for `byInput` (and `min`) before reading
104`amount`. `RateCardError` in `@modelschemas/rate-card` gains `input`: the
105card input the caller did not supply, on `bad-input` "required" and
106`estimate-unavailable`.
107
108**Breaking (0.1.x):** Native DeepSeek cards hold both published rates
109behind required `usage.pricing_period` (`off_peak` or `peak`, #449). The
110service does not choose a period from the clock. Omitting only that choice
111returns `byInput` (#450). An unknown value is refused.
112
113**Breaking (0.1.x):** `opencode-go` endpoint ids moved from `v1/<tail>` to
114the documented `inference/go/<protocol>/v1/<tail>` (#393), e.g.
115`/v1/schemas/opencode-go/chat/inference/go/openai/v1/chat/completions`.
116The next spec sync emits `endpoint.removed` for the old ids. Until it runs,
117polls leave Go models unbound; run `POST /v1/admin/sync/opencode-go` after
118deploy.
119
120**Deprecations:** for Groq and Mistral the poll reads the provider's own
121deprecations page. A model it lists carries `deprecation: { deprecatedAt,
122retiresAt, replacedBy, sourceUrl }` exactly as stated (null where the page
123states nothing) and is deprecated: `deprecatedAt` is set, so it leaves the
124default `GET /v1/models` list (`?deprecated=true` includes it) even while
125it still answers before `retiresAt`. An id the page names that was never in
126a listing gets a retired row with only those facts. Each change to an entry
127is a `model.deprecated` change in `/v1/changes`. Other providers'
128`deprecatedAt` is still when the row was flagged or left the listing.
129
130**Currencies:** rate cards may be in a currency other than USD.
131`moonshotai-cn` and `minimax-cn` are priced in CNY. A USD card is unchanged;
132a card in another currency wraps its price as
133`{ "currency": ["CNY", <expression>] }` (ISO 4217), and that wrapper is the
134only place the currency is stated. `price()` returns an amount in the
135card's currency. **`@modelschemas/rate-card` 0.1.0 cannot read non-USD
136cards: it rejects them at parse and `price()` throws `unknown-op`, so it
137refuses rather than report yuan as dollars. 0.2.0 reads them.**
138`/v1/estimate` and `estimate_cost` return `{ amount, currency }`; `usd` is
139present only for USD cards and is deprecated. List summaries always include
140`currency`. Nothing is converted, so amounts in different currencies never
141compare.
142
143Cards come from each host's own source — the OpenRouter, Together and xAI
144listings (`listing`), and the OpenAI, Anthropic and Gemini pricing pages
145(`docs-derived`); `factSources.pricing` says which. Token models carry
146their cache, media-token and long-prompt rates; models billed by the
147second, the minute, the character, the image or the request carry a
148`quantity × rate[size]` card instead. What a source does not state, a card
149does not guess: an unrecognised surcharge, a rate keyed on something the
150request cannot express, or an alias the pricing page never names leaves the
151model with no card rather than a partial one. A card is re-read when its
152source text changes, or once the `expiresAt` of a dated price change has
153passed.
154
155**Breaking (`@modelschemas/rate-card` 0.2.0):** the package ships built
156JS and .d.ts, not TypeScript source. `zod` is an optional peer
157dependency: install it to import the package root (`rateCardSchema`).
158`@modelschemas/rate-card/evaluator` (`evaluateCard`, `price`,
159`normalizeUsage`) imports no package and runs on edge runtimes.