Model Pricing API
The Model Pricing API resolves model identifiers to token prices and manages project-specific overrides. Provon uses the resolved definition to calculate Gateway and telemetry cost fields.
Base URL:
https://<your-provon-api-origin>/v1Public routes use a project API key:
Authorization: Bearer <PROVON_API_KEY>| Capability | Access |
|---|---|
model-pricing:read |
List resolved prices and test model matching |
model-pricing:write |
Create, update, reset, and delete project overrides |
The default project key includes model-pricing:read.
Endpoints#
| Method | Path | Purpose |
|---|---|---|
GET |
/model-prices |
List defaults plus project-resolved prices |
GET |
/model-price-matches |
Resolve one model/provider pair |
POST |
/model-prices |
Create or replace a project definition |
PATCH |
/model-prices/:modelPriceId |
Update one project definition |
DELETE |
/model-prices/:modelPriceId/override |
Reset an overridden default |
DELETE |
/model-prices/:modelPriceId |
Delete a project-custom definition |
Signed-in Workbench calls use /v1/projects/:projectId/model-prices.... API integrations should
normally use the routes above, where the key selects the project.
List Resolved Prices#
GET /v1/model-prices
Authorization: Bearer <PROVON_API_KEY>Response:
{
"models": [
{
"id": "catalog_openai_gpt_5_mini",
"modelId": "gpt-5-mini",
"providerId": null,
"catalogId": "openai/gpt-5-mini",
"baseModelPriceId": null,
"pricingTiers": [
{
"id": "catalog_openai_gpt_5_mini_tier_default",
"name": "Provon",
"isDefault": true,
"priority": 0,
"conditions": [],
"prices": {
"input": 2.5e-7,
"output": 2e-6
}
}
],
"source": "default"
}
]
}The list is already resolved for the project. A project override replaces or extends its base definition before the response is returned.
Prices are USD per token, not per million tokens. For example, $0.25 / 1M input tokens is
represented as 0.00000025. The catalog shipped with Provon is the sole authority for the cost
fields written into telemetry; provider list prices on upstream vendor pages are not guaranteed
to match. It is a market-price reference for cost attribution, not the menu of official
provon/* models.
Match A Model#
Use the match endpoint before relying on cost projections for a new model:
GET /v1/model-price-matches?providerId=openai&model=gpt-5-mini
Authorization: Bearer <PROVON_API_KEY>Response:
{
"match": {
"model": {
"id": "catalog_openai_gpt_5_mini",
"modelId": "gpt-5-mini",
"providerId": null,
"catalogId": "openai/gpt-5-mini"
},
"pricingTier": {
"id": "catalog_openai_gpt_5_mini_tier_default",
"name": "Provon"
},
"source": "default"
}
}match is null when no definition matches. model is required. A qualified value such as
custom/gpt-5-mini supplies both the provider ID and model ID; otherwise the optional providerId
query parameter supplies the provider ID.
Create A Custom Definition#
POST /v1/model-prices
Content-Type: application/json{
"providerId": "acme",
"modelId": "acme-reasoner-v2",
"pricingTiers": [
{
"id": "standard",
"name": "Standard",
"isDefault": true,
"priority": 0,
"conditions": [],
"prices": {
"input": 8e-7,
"output": 3.2e-6,
"output_reasoning": 3.2e-6,
"input_cache_read": 8e-8,
"input_cache_creation": 1e-6
}
}
]
}providerId scopes a project-custom price to one Gateway provider. Provider IDs are normalized
case-insensitively. modelId is an unqualified model identifier and must not contain /.
Canonical catalog price keys (per token, USD):
| Bucket | Canonical key | Accepted aliases |
|---|---|---|
| Input | input |
input_tokens, prompt_token_count, promptTokenCount |
| Output | output |
output_tokens, candidates_token_count, candidatesTokenCount |
| Reasoning output | output_reasoning |
reasoning_output_tokens, thoughts_token_count |
| Cache read (hit) | input_cache_read |
cache_read_input_tokens, input_cached_tokens |
| Cache creation (write) | input_cache_creation |
cache_creation_input_tokens, cache_creation_input |
Additional non-negative numeric keys are preserved for provider-specific usage detail. The
examples on this page are illustrative; the runtime catalog in packages/model-pricing/src/catalog/
is the source of truth.
Successful creation returns 201 with { "model": ... }. A project-custom definition carries
source: "project_custom".
Pricing Tiers#
Use tiers when price depends on a usage detail such as context length:
{
"id": "long-context",
"name": "Long context",
"isDefault": false,
"priority": 100,
"conditions": [
{
"usageDetailPattern": "input_tokens",
"operator": "gte",
"value": 200000
}
],
"prices": {
"input": 1.6e-6,
"output": 6.4e-6
}
}Condition operators are gt, gte, lt, lte, eq, and neq. Non-default tiers are evaluated
from the smallest priority number to the largest; one tier should be marked as the default
fallback.
Override And Reset#
To override an existing default, create a project definition with baseModelPriceId set to the
default definition ID. The returned source distinguishes the three definition kinds:
source |
Meaning |
|---|---|
default |
Built-in catalog price, unchanged by the project |
project_override |
Project overlay on top of a catalog default price |
project_custom |
Standalone project price not attached to a catalog default |
Update the project definition:
PATCH /v1/model-prices/:modelPriceIdThe update body uses the same complete shape as creation: modelId and a non-empty pricingTiers
array are required. providerId is required for project-custom prices and remains null for
overrides of an unscoped default price.
Reset an override to its default:
DELETE /v1/model-prices/:modelPriceId/overrideDelete a project-custom definition:
DELETE /v1/model-prices/:modelPriceIdBoth operations return:
{
"ok": true
}Cost Resolution#
Provon resolves cost in this order:
- parse the observed value into a provider ID and model ID;
- choose an exact provider-scoped price when one exists;
- otherwise choose the unscoped default price for the model ID;
- choose the highest-priority pricing tier whose conditions match usage details;
- multiply each normalized usage bucket by its unit price;
- write the model, tier, source, and cost breakdown into normalized telemetry.
If no model or required price key matches, the corresponding cost remains null. Provon does not
invent a zero cost for unknown pricing.
The resolved cost breakdown written into telemetry uses these fields (all USD):
| Field | Meaning |
|---|---|
input_cost_usd |
Non-cached input tokens × input price |
output_cost_usd |
Output tokens × output price (reasoning carved out separately) |
reasoning_output_cost_usd |
Reasoning tokens × reasoning price, when priced |
cache_creation_input_cost_usd |
Cache-write tokens × cache-creation price |
cache_read_input_cost_usd |
Cache-hit tokens × cache-read price |
total_cost_usd |
Sum of the above, or null when no bucket priced |
model_price_id / matched_model_name |
Resolved definition and model ID |
pricing_tier_id / pricing_tier_name |
Matched tier |
pricing_source |
default, custom, provided, or unmatched |
Read-Only Price Feed#
For static sites, docs, and local build-time consumption, the package exposes
buildPriceFeed() from packages/model-pricing/src/price-feed.ts. It reads the same
MODEL_PRICES market catalog and emits a normalized, per-1M-USD feed without any network call:
import { buildPriceFeed } from '@provon/model-pricing/price-feed';
const feed = buildPriceFeed();
feed.version; // deterministic 16-hex hash of the underlying prices
feed.source; // "provon-catalog" — market-price reference for trace cost annotation
feed.models; // [{ modelPriceId, modelId, providerId, catalogId, label, defaultRates, conditionalTiers }]Feed conventions:
- Rates are USD per 1,000,000 tokens, not per token. A bucket the catalog does not price
for a model is
null(unavailable), never0. - Canonical buckets in
defaultRates/conditionalTiers[].rates:input,output,output_reasoning,input_cache_read,input_cache_creation. Aliases accepted by the runtime (prompt_token_count,candidates_token_count,cache_read_input_tokens, etc.) are folded into these buckets. - Conditional tiers preserve their
conditions(e.g. context-length thresholds) so consumers do not mistake them for a flat universal rate. - Scope note: the feed describes market catalog prices used to annotate trace costs, not
the curated official
provon/*model menu; official rates live on the models page.
A CLI entry exists for inspection: node scripts/gateway/export-price-feed.ts --out feed.json.
No secret or auth is required; the feed is derived entirely from the committed catalog.
Errors#
| Status | Code | Meaning |
|---|---|---|
400 |
BAD_REQUEST |
Missing model/provider ID, invalid JSON, tier, or condition |
401 |
UNAUTHORIZED |
Missing or invalid project API key |
403 |
FORBIDDEN |
Key lacks model-pricing:read or model-pricing:write |
404 |
NOT_FOUND |
Target definition does not exist |
501 |
MODEL_PRICING_STORE_UNAVAILABLE |
Runtime supports reads but has no pricing store for writes |