Blog
Model pricing API: what to look for and how to use one
A model pricing API returns each AI model's published rates as structured data, usually per million input and output tokens, so software can read a price instead of a person copying it from a provider's page. Meterary's public endpoint, at /api/v1/models, returns every priced model with no key and no sign-up. Each row carries the official page it came from and the date that page was checked.
What a model pricing API should return
A rate on its own is not enough to build on. A bill depends on which model it is, whether that model is still on sale, which tokens the rate applies to and where the number came from. A usable pricing API returns the rate together with that context. The fields that matter most are these:
- slug and provider: a stable identifier for the model and the company that sells it, such as claude-haiku-4-5 from anthropic.
- status: current, legacy or deprecated, as the provider states it. A deprecated model's rate is useful as history but is the wrong choice for new work.
- inputPerMTok and outputPerMTok: the standard-tier price in USD per million tokens, for uncached input and for output.
- cachedInputPerMTok and cacheWritePerMTok: the price of tokens read from a cache and the price of writing to one. Either may be null when the provider does not publish it.
- batchDiscountPct: the percentage discount for asynchronous batch work, where one is published.
- sourceUrl, verifiedAt and confidence: the official page the numbers came from, the date it was read, and whether the figures were confirmed or flagged to verify because the source could not be reached.
The last three fields are the ones most price lists leave out, and they decide whether a number can be trusted in a budget.
The two endpoints
The list endpoint returns every priced model in the dataset, 162 at the time of writing, across eleven providers. Add a provider query parameter with a provider slug to narrow the list to one company. An unknown slug returns a 404 that points to the providers endpoint, so a typo fails loudly instead of returning an empty list.
The single-model endpoint, at /api/v1/models followed by the slug, returns one model plus a priceChanges array of dated changes to its rates. That array lets you ask what a model costs today, and also when its price last moved and from what value to what. The API price change tracker post covers how to read those changes against a workload.
Both responses wrap the data in a meta object with a count, a latestVerifiedAt date, the source origin and a licence line. The routes are set to revalidate every hour, so a caller that reads the list repeatedly is not re-reading the dataset on every request.
Null fields are a decision, not a gap
Mistral Large 3 has an input rate of $0.50 and an output rate of $1.50 per million tokens, but its cached input rate is recorded as null, because the dataset holds no published cached tier for it. The cost calculation does not treat that as zero. It falls back to the full input rate for cached tokens. That is the conservative choice: a cached read is priced as if it were uncached, so the estimate can only overstate the bill.
The cost code applies a different rule to any component with no rate at all. It marks the total as incomplete, so the figure is a lower bound, rather than counting the missing part as free. A pricing API that returns null is telling you what it does not know. Read it as a flag, not as a zero.
A worked example from the dataset
Take one workload: a feature that makes 1,000 requests a day for 30 days. Each request sends 1,200 uncached input tokens and 800 tokens read from a cache, and produces 300 output tokens. Over the month that is 36 million uncached input tokens, 24 million cached input tokens and 9 million output tokens.
Multiplying each count by the rates recorded for three current models gives these monthly figures, in USD:
- Gemini 2.5 Flash: $0.30 input, $0.03 cached, $2.50 output. $10.80 plus $0.72 plus $22.50 gives $34.02.
- Mistral Large 3: $0.50 input, cached falling back to $0.50, $1.50 output. $18.00 plus $12.00 plus $13.50 gives $43.50.
- Claude Haiku 4.5: $1.00 input, $0.10 cached, $5.00 output. $36.00 plus $2.40 plus $45.00 gives $83.40.
Two things stand out. For Gemini 2.5 Flash and Claude Haiku 4.5 the output line is the largest, even though output is only 300 tokens a request against 2,000 tokens of input, because each output token is priced several times above an input token. For Mistral Large 3 the largest line is input, and its position is set partly by the missing cache rate, which is why the fallback matters. Anyone can reproduce these totals from the three rates and the token counts; no hidden multiplier is involved.
Rates behind the worked example
USD per 1M tokens · verified as of 2026-07-02
Rendered from the dataset at request time, so these figures can move. The worked example uses the rates as recorded when the dataset was last verified.
Check the verification date before you trust a rate
Every model in the dataset currently carries the same verifiedAt date, 2 July 2026, which the latestVerifiedAt field reports. That is the date the rows were read from their source pages, not the date you are reading this. Four months is long enough for a provider to revise a rate or retire a model, so treat the figures above as a worked method and confirm the live rate on the official page before committing a budget to it.
The official pages the dataset cites for these models are Anthropic's pricing documentation at platform.claude.com/docs/en/about-claude/pricing, Google's Gemini API pricing at ai.google.dev/gemini-api/docs/pricing, and Mistral's API pricing at mistral.ai/pricing/api. Those are the pages to check first.
Using the API in your own code
- Cache the response. The routes already revalidate hourly, so a nightly job that reads the list once is ample for a budget. Polling on every request adds nothing.
- Key your lookups on slug, not on display name. The slug is unique across the dataset, so it is the safer key.
- Store the rate you used with each cost estimate. A figure can only be reproduced if you keep the input rate, output rate and date it was computed from, because the provider may revise its page later.
- Branch on status. Route new work to current models, and label legacy or deprecated rates as history.
- Keep the attribution line. The data is free to use with attribution to Meterary and its origin, and the meta object carries the wording.
Frequently asked questions
Is the model pricing API free to use?
Yes. The list and single-model endpoints are read-only and need no key. The licence in the meta object asks for attribution to Meterary with a link to its origin, and that is the only condition attached.
Does it cover models other than text generation?
The modality field separates text, multimodal, embedding, image and audio models, so your code can filter the list by what a workload actually needs before it compares prices.
Are the prices live from each provider?
No. The dataset is a record of published rates, each read from an official page on a stated date. It is built to show when that reading happened and where it came from, so you can judge whether it is fresh enough for your use.
How do I see when a price last changed?
Request the single-model endpoint. Its priceChanges array lists each recorded change with its date, the field that moved, the old and new values and the source URL. An empty array means no change has been recorded, which is not the same as a guarantee that none occurred.
Where to go next
If you are estimating a bill rather than building a feed, the LLM API cost calculator applies these rates to your own token counts. For how a rate changes over time, read the API price change tracker and why AI API prices keep changing. To see what the numbers mean for a build, how to estimate LLM costs before you build walks through the inputs, and prompt caching cost savings explained covers the cached-token line in detail.
Related reading
Blog
What-if AI model cost comparison: price the same workload before you switch
A practical what-if AI model cost comparison: use one project's token totals, compare the same workload across models, and check quality and price freshness before switching.
Blog
Why AI API prices keep changing
AI API price history: why LLM API prices shift more often than infrastructure costs, what usually drives a change, and how to track it before your bill does.
Blog
API price change tracker: how to know when a model's price moved
What an API price change tracker should record per model, how to read a dated change against your workload, and how to keep the record current.