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