Model price data API
Read structured pricing, source evidence, and fixed dataset versions. This page records the draft contract.
API overview
Both read-only paths share one field and pagination contract. The compatibility path does not expose another dataset.
The backend endpoint is not available
This page validates the first public data contract. The example host cannot resolve, the record is not live pricing, and no request is sent.
/api/v1/model-pricesVersioned primary entry point for the model price catalog.
/api/model-prices.jsonRead-only JSON compatibility path mapped to the same contract.
- Method
- GET
- Authentication
- No credentials for the planned public read endpoint
- Format
- JSON, UTF-8
Quick start
These snippets use the reserved .invalid domain and only demonstrate parameter structure.
shellcurl --get 'https://api.example.invalid/api/v1/model-prices' \
--data-urlencode 'source_provider_key=openai|anthropic' \
--data-urlencode 'model_type=reasoning' \
--data-urlencode 'currency=USD' \
--data-urlencode 'page=1' \
--data-urlencode 'page_size=20'javascriptconst params = new URLSearchParams({
model_type: 'reasoning',
currency: 'USD',
page: '1',
page_size: '20',
});
const response = await fetch(
`https://api.example.invalid/api/v1/model-prices?${params}`,
{ headers: { Accept: 'application/json' } },
);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const payload = await response.json();Query parameters
Unknown parameters and out-of-range values return 422. They never become database column names.
| Parameter | Type | Default | Example | Description |
|---|---|---|---|---|
qOptional | string | None | reasoning | Matches model name, model ID, or manufacturer name, up to 80 characters. |
source_provider_keyOptional | string | None | openai|anthropic | Source manufacturer keys separated by pipes, with at most 10 values. |
source_regionOptional | string | None | global | Source region for the price record, such as global or china. |
model_typeOptional | string | None | reasoning | Filters by model purpose. Unknown enum values return 422.chat | reasoning | multimodal | embedding |
provider_keyOptional | string | None | official | Filters by the provider publishing the price or access service. |
currencyOptional | enum | original | USD | Selects original currency or a display conversion. Original amounts are always retained.original | USD | CNY |
pageOptional | integer | 1 | 1 | One-based page number within a fixed dataset snapshot. |
page_sizeOptional | integer | 20 | 20 | Records per page, from 1 to 100. |
Response structure
Amounts are decimal strings. null means unknown or unpublished, while the string 0 means confirmed free.
json{
"data": [
{
"model_id": "contract-example-text",
"model_name": "Contract Example Text",
"manufacturer": {
"key": "example-manufacturer",
"name": "Example Manufacturer"
},
"provider": {
"key": "example-provider",
"name": "Example Provider",
"region": "global"
},
"capabilities": {
"tool_calling": true,
"reasoning": false
},
"modalities": {
"input": [
"text"
],
"output": [
"text"
]
},
"limits": {
"context_tokens": 128000
},
"price_version": "example-price-version",
"price_items": [
{
"kind": "input",
"amount": "1.25",
"currency": "USD",
"unit": "1M_tokens"
},
{
"kind": "cache_write",
"amount": null,
"currency": "USD",
"unit": "1M_tokens"
},
{
"kind": "cache_read",
"amount": "0",
"currency": "USD",
"unit": "1M_tokens"
}
],
"tiers": [],
"source": {
"label": "Documentation example",
"url": null,
"observed_at": null
},
"quality": {
"state": "example",
"confidence": null,
"expires_at": null
},
"conversion": {
"requested_currency": "original",
"fx_snapshot": null,
"items": []
}
}
],
"meta": {
"schema_version": "1",
"dataset_version": "example-dataset",
"as_of": null,
"total": 1,
"page": 1,
"page_size": 20,
"fx_snapshot": null
}
}Model and capabilities
data[].model_idstring- Stable model identifier, separate from its display name.
data[].model_namestring- Human-readable model name.
data[].manufacturerobject- Key and name of the source model manufacturer.
data[].providerobject- Provider and region publishing the price or access service.
data[].capabilitiesobject- Boolean capabilities such as tool calling and reasoning.
data[].modalitiesobject- Input and output modality arrays.
data[].limitsobject- Published limits such as context size. Unknown values remain null.
Price structure
data[].price_versionstring- Version identifier for the price structure.
data[].price_items[]array- Input, output, cache, and other billable items. Amounts use decimal strings.
data[].tiers[]array- Thresholds and prices for tiers. An empty array means no published tier.
data[].conversionobject- Separate display conversion and its foreign-exchange snapshot.
Source and quality
data[].sourceobject- Source label, public URL, and observation time.
data[].qualityobject- Quality state, confidence information, and expiry time.
Dataset metadata
meta.schema_versionstring- Response schema version.
meta.dataset_versionstring- Fixed pagination snapshot version.
meta.as_ofdatetime|null- Dataset observation cutoff, or null when unpublished.
meta.totalinteger- Total records for the current filters.
meta.pageinteger- Current page number.
meta.page_sizeinteger- Current records per page.
meta.fx_snapshotobject|null- Foreign-exchange snapshot used for conversion, or null for original currency.
Caching and read consistency
Fixed snapshots prevent duplicate or missing records during pagination. These cache rules remain part of the draft contract.
Fixed dataset snapshot
Pagination remains stable within one dataset_version. Expired snapshots return 410.
Conditional requests
ETag covers dataset, filters, FX snapshot, and page. Matching If-None-Match returns 304 without a body.
Public cache
The initial public cache target for successful responses is 60 seconds.
Rate limit
The initial plan allows 60 read requests per minute for each IP.
Error handling
No data returns 200 with an empty array. Only request, snapshot, limit, or dataset failures use these states.
| Status | Code | Description |
|---|---|---|
| 304 | not_modified | ETag is unchanged and the response has no body. |
| 410 | snapshot_expired | The dataset snapshot expired. Start again from the first page. |
| 422 | invalid_query | The query contains an unknown parameter, invalid enum, or out-of-range value. |
| 429 | rate_limited | The current IP exceeded the public read limit. |
| 503 | dataset_unavailable | The published dataset is temporarily unavailable. The service does not invent replacement prices. |
json{
"error": {
"code": "unknown_parameter",
"message": "Unsupported query parameter: order_by",
"details": [
{
"field": "order_by",
"accepted": [
"q",
"source_provider_key",
"source_region",
"model_type",
"provider_key",
"currency",
"page",
"page_size"
]
}
]
},
"meta": {
"schema_version": "1",
"request_id": "example-request-id"
}
}