Pricing
Every amount on the platform is an integer number of micro-USD: 1,000,000 micro-USD = $1.00. No floats, no rounding surprises, and safe to sum.
1 micro-USD = $0.000001
1,000 µ$ = $0.001
1,000,000 µ$ = $1.00Where prices come from
GET /v1/models returns, per model, the customer list price (pricing) and your discount (discount_bps). Prices are per unit of usage:
| Price key | Charged per |
|---|---|
input_per_mtok | 1,000,000 prompt tokens |
output_per_mtok | 1,000,000 completion tokens |
cached_input_per_mtok | 1,000,000 cached prompt tokens (when reported by the provider) |
per_request | request |
per_image | generated image |
per_audio_second | second of speech synthesised or transcribed |
per_video_second / per_music_second | second of generated media |
per_character | input character (some speech models) |
A model may combine several keys (e.g. per_request + per_image). The price sheet is versioned; the version in force when your request ran is recorded with the request.
How a charge is computed
list_price_micro = Σ usage_i × price_i (per_mtok rates ÷ 1,000,000, rounded half-up)
discount_bps = the single best discount that applies to you
(api_key > organization > model > global — not stacked)
discount_micro = round(list_price_micro × discount_bps / 10,000)
charged_micro = list_price_micro − discount_microcharged_micro is what you see in usage.x_llm_cost_micro, the X-LLM-Cost-Micro header, cost_micro on jobs, and what is debited from your balance and counted against budgets.
Worked example
openai/gpt-4o-mini with input_per_mtok: 150000, output_per_mtok: 600000, discount_bps: 1000 (10 %). A request uses 2,000 prompt tokens and 500 completion tokens:
input = 2000 × 150000 / 1e6 = 300 µ$
output = 500 × 600000 / 1e6 = 300 µ$
list = 600 µ$
discount= round(600 × 1000 / 10000) = 60 µ$
charged = 540 µ$ → usage.x_llm_cost_micro = 540 ($0.00054)const microToUsd = (m: number) => m / 1_000_000;
const estimate = (promptTokens: number, completionTokens: number, p: { input_per_mtok: number; output_per_mtok: number }, discountBps: number) => {
const list = Math.round((promptTokens * p.input_per_mtok) / 1e6) + Math.round((completionTokens * p.output_per_mtok) / 1e6);
return list - Math.round((list * discountBps) / 10_000);
};Savings
The dashboard reports savings per request and in aggregate:
savings_micro = max(list_price_micro, list price of the most expensive eligible provider for the same usage) − charged_micro (floor 0)In words: what you would have paid at the most expensive route that could have served the request, minus what you actually paid. Discounts always count as savings; routing to a cheaper provider adds to them.
Estimates, reservations and settlement
Before a request runs, the gateway estimates its cost using the most expensive eligible provider (conservative) and the estimated usage: ceil(chars / 4) input tokens (+1,000 per image), max_tokens (or the model default) output tokens, n images, or duration_seconds for media. That estimate is:
- checked against your balance, key budgets and organization limits (→
402if it does not fit), - reserved for the duration of the request, then settled to the actual charge when the response completes (or the job finishes). Partial streams are settled to the tokens actually generated.
Async jobs reserve 1.5 × estimate unless you pass max_cost_micro; the difference is released on completion.
Reading pricing from /v1/models
curl -s "https://api.smartapihub.com/v1/models" -H "Authorization: Bearer $LLM_API_KEY" \
| jq '.data[] | {id, pricing, discount_bps, providers}'{
"id": "openai/gpt-4o-mini",
"pricing": { "input_per_mtok": 150000, "output_per_mtok": 600000, "currency": "USD", "unit": "micro" },
"discount_bps": 1000,
"providers": 2
}pricing is the list price for your organization (operators may set organization-specific prices). discount_bps already reflects the best discount available to your key. To show dollars, divide by 1,000,000 and format with up to 6 decimals for small amounts.
Do not compute cost client-side for billing purposes — read usage.x_llm_cost_micro from each response. Client-side math is for estimates and UI only; the gateway's cost engine is the source of truth and is recorded per request.