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