Skip to main content
Version: Dev

Model Pricing

The control plane calculates request cost from the usage it observes and the price associated with the upstream provider and model. Most models are priced on token counts; models billed by duration are priced on audio length. Configure a pricing override when a model has no catalog price or when your organization uses a different rate.

Prices can also vary by input length or service tier. These prices are platform prices: what a model costs you. A model can also carry a sale price, which bills the requests it applies to in place of the platform price, and an off-peak discount on that sale price. To see how these values produced a recorded cost, read its cost breakdown.

Pricing affects the spend shown in Usage and the totals evaluated by budgets. Prompt and completion rates can also affect target ordering for least_cost routing groups. Pricing does not change what the upstream provider charges.

Choose the Organization Currency​

Each organization records every amount in one currency: US dollars (USD, the default) or Chinese yuan (CNY). Owners and admins choose it in Settings → General → Currency; see Organization Currency.

Prices are entered by hand in the organization's currency. AISIX has no exchange rate and converts nothing:

  • The models.dev catalog is priced in USD, so it applies only to a USD organization. In a CNY organization, catalog prices are not used anywhere: not to bill requests, not to rank least_cost targets, not as price hints in the model form, and not in the Catalog tab of the Model pricing page. A model the organization has not priced has no price, so its requests record no cost and least_cost ranks it last. Set a price for every model you use.
  • Switching the currency does not convert recorded history. Usage costs, budget limits, budget spend, and prices keep their numbers and are read in the new currency from then on.
  • Admin API names for amounts carry no currency, such as prompt_per_1m and cost. These responses state the currency in a top-level currency field: GET /model_pricing, the usage-event list, usage_summary, usage_analysis, and usage_analysis/breakdown. A JSON usage export carries it in the trailer after the rows, and a CSV usage export in its last column, currency. It is the organization's current currency, so amounts recorded before a currency switch are reported in it unconverted.
  • The older names with a _usd suffix, such as prompt_usd_per_1m and cost_usd, remain as deprecated aliases and carry the organization's currency despite their name. Responses return both names with the same value. Requests accept either name, and a request that sends both names for one field with different values is rejected with 400.

The currency also appears wherever AISIX reports money: the dashboard's amounts, the budget rejection message, budget alert notifications, the currency field of the alert webhook document, and the currency column of an AISIX Enterprise organization backup.

How AISIX Resolves Prices​

AISIX applies the configured rates without hidden multipliers. Each usage event resolves a price by the exact (provider, model name) pair:

  1. An organization override wins when it matches the provider and model name.
  2. Otherwise, in a USD organization, AISIX uses the matching catalog default from models.dev. A CNY organization skips this step.
  3. If neither source matches, the usage event retains its reported usage but records zero spend.

A catalog default exists only for a model that models.dev lists with a price. A model it does not list, such as OpenAI's whisper-1, gpt-4o-transcribe, and tts-1, and a model it lists without price fields, are billed only after you configure a price for them. Until then, their usage is recorded with a cost of 0.

Four rules then adjust the result:

  • A request that a model's sale price can bill is billed at that sale price instead of the platform price, as described there.
  • When the price that applies carries service-tier rates and one of its entries names the tier the upstream reported serving the request at, that entry's rates replace the price's base token rates.
  • A request billed at a sale price whose model has an off-peak discount, and that completes inside one of its windows or on a day of one of its date ranges, has its cost multiplied by the discount. A request billed at the platform price is never discounted.
  • A request answered from the gateway's response cache costs 0, whatever kind of model it was addressed to and whether a sale price applies. Its usage event keeps the replayed token counts and the cache-savings counters. Earlier control-plane versions billed a cache hit on a direct model at the model's full price.

Catalog refresh behavior depends on how pricing synchronization is configured. In online mode, the control plane refreshes the catalog at startup and every 24 hours. If a refresh fails while the catalog is still empty, such as on a host that cannot reach models.dev, the control plane loads the catalog snapshot bundled in its image instead, and later successful refreshes update it. An existing catalog is never replaced by the snapshot.

A refresh skips a catalog row when its stored entry is unchanged. The row's Updated time on the Model pricing page therefore records when the entry last changed, not when the catalog was last refreshed. By default, the AISIX Enterprise Docker Compose package loads the bundled catalog snapshot at startup, even when it has internet access. To enable online synchronization for that package, see Pricing Catalog.

Within a matching price, AISIX calculates token and duration cost independently, then adds the two terms. Token pricing uses the prompt and completion rates, with the cache and reasoning fallbacks described below. Duration contributes only when the event reports audio length and Audio per minute is nonzero.

Cost is calculated and stored when the usage event is recorded. A pricing change applies to later events and does not re-price historical usage.

The control plane is the authoritative component for cost. Current gateways report token counts without calculating cost. Their usage events in SLS, object storage, or Datadog therefore carry no cost field. A gateway that runs without a control plane exports no cost either. Read cost from the control plane's usage data: the usage events of the Admin API and their export. The gateway exports no spend metric.

How Reasoning Tokens Are Billed​

Upstreams count reasoning in two different ways. OpenAI, for example, counts it inside completion_tokens and names the reasoning part separately. Gemini on the Vertex AI adapter can report its thinking tokens beside the completion instead. Usage events keep the counts as the upstream reported them, so the control plane decides per event which accounting applies, using the total the upstream itself reported (total_tokens):

  • Reasoning beside the completion. This applies when total_tokens and reasoning_tokens are both greater than zero, and total_tokens equals prompt + completion + reasoning tokens but not prompt + completion tokens. The whole of completion_tokens bills at the completion rate, and the whole of reasoning_tokens bills at the reasoning rate.
  • Reasoning inside the completion. Every other event, including every event without a reported total, is priced this way. reasoning_tokens bills at the reasoning rate, and the rest of completion_tokens, never below zero, bills at the completion rate. An upstream that reports more reasoning than completion is therefore billed for the reasoning it reported and nothing more.

An event with an estimated count carries no total, so it is always priced with reasoning inside the completion. When the upstream reported its completion with the reasoning beside it, the gateway adds the reasoning into that event's completion_tokens, so the reasoning bills the same as it would have against the upstream's total.

Either way, a model with no distinct reasoning rate bills reasoning at its completion rate. For example, both of these events bill 20 tokens at the completion rate and 30 at the reasoning rate:

UpstreamPromptCompletionReasoningReported totalAccounting
Gemini on Vertex AI1002030150Beside the completion
OpenAI1005030150Inside the completion

Cached input is recorded as reported too. An OpenAI-shape upstream counts both its cache reads, cached_prompt_tokens, and its cache writes, cache_write_tokens, inside prompt_tokens, so both are taken out of the input billed at the prompt rate. When they add up to more than prompt_tokens, no uncached input is billed rather than a negative amount.

/v1/messages and /v1/completions record reasoning_tokens and total_tokens the same way /v1/chat/completions does, so reasoning tokens reaching those two endpoints bill at the model's reasoning rate. See Recorded Token Counts for what each counter holds.

Review the Prices in Use​

The Model pricing page opens on the In use tab. It lists the prices of the models your environments actually dispatch to, from every environment, together with every price the organization set itself:

  • Prices in use lists each priced (provider, model name) pair that a direct or embedding model names. A model whose model name is a * template is not listed, because it names no concrete model.
  • In use without a price lists the pairs in use that have no price. Requests to them record no cost until you select Set price and enter one. In a CNY organization, every pair in use that the organization has not priced appears here.
  • Sale prices lists the models of every kind that carry a sale price, each with a badge for its kind, together with their off-peak discounts. A sale price that sets a one-hour cache write rate also shows a One-hour cache write badge with that rate. Select Edit on the model to change one.

The Catalog tab shows every price, including the catalog defaults. In a CNY organization it lists only the model names each provider offers, without catalog prices, so you can find a model and set its price.

In the Admin API, GET /model_pricing?view=in_use returns the same view: priced pairs in data, unpriced pairs in unpriced, and the sale-priced models in sale_priced_models, each with its model_id, env_id, env_name, display_name, kind, price, and off_peak. Paging applies to data only. The older model_groups field is deprecated: it still lists only the routing models that carry a sale price or an off-peak discount.

Identify a Missing Price​

Start with an expanded event in Request Logs, which shows the cost of each usage event or routing attempt to six decimal places. The aggregate Usage view rounds spend to two decimal places and shows only the top 10 environment/model rows. Therefore, zero spend or an absent model in Usage does not prove that pricing is missing. When checking a very low-priced request, generate enough token usage to make the expected cost visible before concluding that a price is missing.

A catalog price can be missing when:

  • The model runs on a self-hosted or reseller upstream that models.dev does not price.
  • The configured model name is a custom alias.
  • The provider offers a newer model that the catalog does not yet include under that provider.

In a CNY organization, a missing price usually means the organization has not priced the model yet, because catalog prices do not apply. Check In use without a price on the In use tab.

The Dashboard also flags a missing price while you create or edit a direct or embedding model, and links to the price dialog for it. See Create a Direct Model.

Before adding an override, note the provider and model name exactly as they are configured. A pricing row that differs from either value does not match the usage event.

Add a Pricing Override​

  1. Open Model pricing from the organization navigation.
  2. Select Add pricing.
  3. Enter the Provider and Model name exactly as configured on the model. The Provider field suggests known catalog providers but also accepts a custom value.
  4. Configure the basis the provider charges. Every rate is in the organization's currency:
    • For a token-priced model, enter the Prompt and Completion rates per 1M tokens and leave Audio per minute at 0.
    • For a duration-priced speech-to-text model, leave the token rates at 0 and enter the Audio per minute rate per minute of audio, such as 0.006.
  5. For a token-priced model, optionally enter distinct Cache read, Cache write, One-hour cache write, 12-hour cache write, and Reasoning rates. To price by input length instead of one flat rate set, select Price by input-token tier; see Price by Input-Token Tier.
  6. To bill requests served at a fast or priority tier at their own rates, add them in Service tier prices (optional); see Price by Service Tier.
  7. Save the override.

The cache and reasoning rates price the upstream's prompt-cache reads, prompt-cache writes, and reasoning tokens. Cache write prices an Anthropic-style five-minute write and an OpenAI-style write other than a 12-hour one. A one-hour write, which the usage event records separately in its split by lifetime, bills as follows:

  • At the One-hour cache write rate, cache_write_1h_per_1m in the Admin API, when the price sets one. It applies to the base rates only, which the first input-token tier shares: a higher input-token tier or a service-tier entry never uses it.
  • Otherwise, for a Claude model served by Anthropic, Amazon Bedrock, or Google Vertex AI, at twice the input rate in effect, including the rate of the input-token tier or service-tier entry that the request selects. This matches how those providers charge a one-hour write. AISIX recognizes such a model by the price's provider (anthropic, amazon-bedrock, google-vertex, or google-vertex-anthropic) and a model name that contains claude, ignoring case. A model name without it, such as a Bedrock application inference profile ARN, is not recognized as Claude.
  • Otherwise at the Cache write rate. This covers every other model, Claude served through Azure AI Foundry or a reseller, and a request on the decision endpoints, where a decision-endpoint cache write rate also replaces the one-hour rate.

A request billed at a sale price uses the sale price's own One-hour cache write rate, which also applies to the base rates only. When the sale price leaves it blank, a one-hour write bills at the sale price's cache write rate in effect. The twice-the-input rule for Claude models applies to platform prices only, never to a sale price.

A write that the upstream does not split by lifetime bills entirely at the Cache write rate. Leave one blank, null in the Admin API, to fall back: cache tokens then bill at the prompt rate, and reasoning tokens at the completion rate. Enter 0 only to make that token class free. The same rate set, with the same fallbacks, applies to each price tier and to a sale price.

OpenAI Cache Writes​

An OpenAI-compatible upstream reports its prompt-cache writes as cache_write_tokens, which are part of prompt_tokens. AISIX takes them out of the ordinary input and bills them at the Cache write rate, or at the prompt rate when that rate is blank. A model without a cache write rate therefore costs what it did before.

The part written with a 12-hour retention, which a 1.10.0 or later gateway records as cache_write_12h_tokens, bills at the 12-hour cache write rate instead, cache_write_12h_per_1m in the Admin API. The rest of the write, including the 30-minute part and a write the upstream did not split, bills at the Cache write rate. A 12-hour rate can be set wherever a cache write rate can: on the price's base rates, on each input-token tier, on each service-tier entry and its tiers, and on a sale price and its tiers. The decision-endpoint rates have none. On a tiered price, the price's own 12-hour rate is a separate field, 12-hour cache write (default for every tier), that a tier left blank uses.

A 12-hour write bills at the first of these rates that is set:

  1. The 12-hour rate of the input-token tier the request selects.
  2. The 12-hour rate of the price being applied: the platform price, or the sale price when one bills the request.
  3. Twice the cache write rate in effect, when a cache write rate is set.
  4. The input rate in effect.

Under a service-tier entry, the order is the entry's own tier, the entry, the price's base 12-hour rate, twice the entry's cache write rate, and the entry's input rate. Unlike the entry's cache write rate, which falls back to the entry's input rate, a blank 12-hour rate on an entry keeps the price's base 12-hour rate.

On the decision endpoints, a decision-endpoint Cache write rate, when set, bills every write, including the 12-hour part. Without one, writes bill as described above.

Cost is calculated when the event is recorded and is not recalculated later. A control plane before 1.10.0 billed OpenAI-style writes as ordinary input, and the events it recorded keep that cost. Events recorded after the upgrade are priced this way whichever gateway version reported them, as long as it reports cache_write_tokens. Only a 1.10.0 or later gateway reports the 30-minute and 12-hour split, and only when the upstream returns it, so an older gateway's whole write bills at the Cache write rate.

Price by Input-Token Tier​

Some providers charge a higher rate for a long request. A tiered price selects its rates by the size of the request's input:

  • The input size is the request's input tokens, cache reads and cache writes included. Output length never changes the tier.
  • Each tier has an inclusive Up to (input tokens, inclusive) limit, and the limits increase from tier to tier. The last tier has no limit and covers every larger request. A tiered price has at least two tiers.
  • The whole request bills at the rates of the first tier whose limit covers its input. Tiers are not marginal: a request one token over the first limit bills every token at the second tier's rates.
  • Each tier carries the full rate set: prompt, completion, cache read, cache write, and reasoning. A tier can also carry its own 12-hour cache write rate.
  • The price's top-level rates equal the first tier's, and least_cost routing ranks targets on them.

For example, with a first tier up to 200000 input tokens and an unlimited second tier, a request with 150,000 uncached input tokens and 60,000 cache-read tokens has an input of 210,000 tokens, so the whole request, output included, bills at the second tier's rates.

In a USD organization, a catalog price carries the long-context tiers models.dev publishes for the model, and they refresh with the catalog. The catalog's base rates become the first tier, up to and including the first threshold, and each published threshold starts the next tier; the highest tier has no limit. The same rules as above select the tier: the whole request bills at the tier its input crosses into, and a request exactly at a threshold stays in the lower tier. A catalog tier that publishes no cache read, cache write, or reasoning rate inherits that rate from the first tier, so a long-context cache read is not billed at the full input rate. When a model's catalog tiers cannot be represented, its catalog price stays flat. An organization override replaces the whole catalog price, tiers included.

To configure tiers in the Add pricing dialog:

  1. Select Price by input-token tier.
  2. Edit each tier's limit and rates.
  3. Use Add tier or Remove tier to adjust the number of tiers.

A tiered row shows a tier-count badge on the Model pricing page. Clearing Price by input-token tier makes the first tier the flat price again.

In the Admin API, send the tiers as the tiers array of PUT /model_pricing/precise or PUT /model_pricing. The top-level rates must equal the first tier's, otherwise the request is rejected. null is a flat price:

{
"provider": "google",
"model_name": "gemini-2.5-pro",
"prompt_per_1m": 1.25,
"completion_per_1m": 10,
"cache_read_per_1m": 0.31,
"tiers": [
{"max_input_tokens": 200000, "prompt_per_1m": 1.25, "completion_per_1m": 10, "cache_read_per_1m": 0.31},
{"max_input_tokens": null, "prompt_per_1m": 2.5, "completion_per_1m": 15, "cache_read_per_1m": 0.625}
]
}

Decision-endpoint rates and Audio per minute are not tiered. They apply on top of whichever tier the request selects. Tiers are also available on a sale price.

Price by Service Tier​

Some providers serve a request at a faster or cheaper service tier and charge a different rate for it, such as OpenAI's priority processing or Anthropic's fast mode. A price can carry service-tier rates that bill those requests at their own rates.

The tier that selects the rates is the one the upstream reports it actually served the request at, recorded as the usage event's service_tier. It is never the tier the request asked for. A request that asks for a fast tier but that the upstream serves at its standard tier bills at the base rates.

  • Each entry lists one or more tier names in match and carries a full rate set: prompt, completion, cache read, cache write, and reasoning, and optionally a 12-hour cache write rate. A blank cache rate falls back to the entry's own prompt rate, and a blank reasoning rate to the entry's own completion rate. An entry can also be tiered by input length, with the same rules as input-token tiers.
  • The event's service_tier is compared with every match value, ignoring case and surrounding whitespace. The entry that names it replaces the price's base token rates and input-token tiers for that request.
  • A request whose tier no entry names, or whose upstream reported no tier, bills at the base rates.
  • A price holds at most 16 entries, and an entry at most 16 match values of up to 256 characters each. A value can appear in only one entry of a price, ignoring case, so a reported tier selects at most one entry.
  • Decision-endpoint rates and Audio per minute have no per-tier values. They apply the same way whichever entry a request selects.
  • A response cache hit still costs 0, and a sale price's off-peak discount multiplies the cost that the selected entry produced.
  • Service-tier rates affect recorded cost and budgets only. least_cost routing ranks targets on the base rates.

Use the tier names the upstream reports, because AISIX passes the reported value through as is, and the name can differ from the requested tier and from model to model. When OpenAI serves a request with priority processing, GPT-6 models report fast and earlier models report priority, so an entry you write for it lists both names. A request OpenAI downgrades to Standard reports default and uses the base price unless an entry also matches that name. Anthropic's fast mode reports fast. To find the value your upstream reports, expand one of its requests in Request Logs and read Service tier.

To configure service-tier rates in the Add pricing dialog:

  1. Expand Service tier prices (optional) and select Add service tier price.
  2. Type each tier name in Service tier names and press Enter.
  3. Enter the rates for the service tier.

Use Remove service tier price to delete an entry.

In the Admin API, send the entries as the service_tier_prices array of PUT /model_pricing/precise or PUT /model_pricing. A save replaces the whole price, so a request that omits service_tier_prices or sends null removes them. The following price bills requests that the upstream served at priority or fast at one set of rates, and requests served at ultrafast at another. The rates are illustrative:

{
"provider": "openai",
"model_name": "gpt-5",
"prompt_per_1m": 1.25,
"completion_per_1m": 10,
"cache_read_per_1m": 0.125,
"service_tier_prices": [
{"match": ["priority", "fast"], "prompt_per_1m": 2.5, "completion_per_1m": 20, "cache_read_per_1m": 0.25},
{"match": ["ultrafast"], "prompt_per_1m": 5, "completion_per_1m": 40, "cache_read_per_1m": 0.5}
]
}

Where the service-tier rates come from depends on the price:

  • In a USD organization, a catalog price carries the rates that models.dev publishes for the model's service-tier modes, and they refresh with the catalog. Each entry matches both the tier value that selects the mode and the mode's name, because an upstream can report either.
  • An organization override replaces the whole catalog price, service-tier rates included. An override without service-tier rates bills every request at its base rates, so enter in the override any tier rates you still want.
  • A CNY organization uses no catalog prices, so it enters service-tier rates by hand.

Service-tier rates are also available on a sale price. A gateway at 1.6.x or earlier reports no service tier, so its requests always bill at the base rates.

Price a Model Billed by Audio Length​

Some speech-to-text models are billed per minute of audio rather than per token and report no token counts. Such a request records its audio length instead, and the Audio per minute rate turns that length into spend. A model left at 0 for this rate contributes no duration-based cost.

The current AISIX catalog does not supply duration rates, so there is no default to inherit: create the row with the provider and model name exactly as configured. For example, OpenAI currently lists whisper-1 at $0.006 per minute. At that rate, a 60-second transcription costs $0.006.

caution

Token and duration costs are additive. If an event contains both token usage and audio duration, and the matching price has nonzero rates for both, AISIX adds both terms. Configure only the usage basis that the provider charges.

Price the Decision Endpoints​

A pricing override can carry a separate set of rates for requests on the decision endpoints, /v1/systemone and /v1/decisions. Use it when a model is billed differently there than on its other endpoints, or to price a decision model the catalog does not list.

  1. In the Add pricing dialog, enter the base rates as usual.
  2. Expand Decisions pricing (optional). The section notes that its rates apply to requests on /v1/systemone and /v1/decisions, and that a blank rate uses the matching rate above.
  3. Enter the decision-endpoint rates you need, and leave the others blank.
  4. Save the override.

Each decision-endpoint rate you set replaces the matching base rate for those requests, whichever request format the caller used. A blank rate keeps the base rate. The cache and reasoning fallbacks then run over the rates in effect, so a decision request's cache tokens fall back to its decision-endpoint prompt rate when one is set. Leaving every rate blank stores no decision-endpoint rates.

In the Admin API, send the rates as the decisions object of the price, with the fields prompt_per_1m, completion_per_1m, cache_read_per_1m, cache_write_per_1m, and reasoning_per_1m. A save replaces the whole price, so a request that omits decisions or sends null clears the decision-endpoint rates.

Decision-endpoint rates affect recorded cost and budgets only. least_cost routing still ranks targets on the base rates.

Set a Sale Price​

The prices described so far are platform prices: what the model that serves a request costs you. A model can also carry a sale price, which is what you charge for the requests it bills. The request's recorded cost, cost, is then the sale price instead of the platform price, while its platform cost, upstream_cost, stays the serving model's platform price. Use it to resell a model at your own rates, or to discount it off-peak.

Direct, embedding, and routing models accept a sale price. Semantic routers, ensemble models, and wildcard aliases reject it with 400, and so does a rename that would turn a model with a sale price into a wildcard alias. A semantic router also rejects an off-peak discount, with the message off_peak is not valid on semantic models. It has no price of its own because its requests are billed at the target it selects, as described in Bill a Semantic Router's Requests.

Which Price Bills a Request​

Each request is billed at exactly one price, the first of these that can bill it:

  1. The sale price of the model the request addressed, with that model's off-peak discount.
  2. The sale price of the model that served the request, with that model's off-peak discount.
  3. The platform price of the model that served the request, without any discount. This is what the request costs when no sale price applies.

For a model called directly by name, the first two are the same model. A routing model's sale price therefore bills every request addressed to it, whichever target serves it and even when that target has no platform price. A target's own sale price bills the requests addressed to the target directly, and the requests addressed to a model group whose sale price cannot bill them or that has none.

A sale price cannot bill two kinds of request that it may have no rates for. Such a request falls through to the next price in the list:

  • A request on the decision endpoints, /v1/systemone and /v1/decisions, unless the sale price sets at least one decision-endpoint rate, decisions in the Admin API.
  • A request that the platform price bills by audio length, unless the sale price's Audio per minute rate, duration_cents_per_1m_seconds in the Admin API, is above 0.

The following rules also apply:

  • A request addressed to a semantic router is billed as if the caller had addressed the target the router selected. See Bill a Semantic Router's Requests.
  • A request forwarded by a passthrough route is never billed at the sale price of the model its body names.
  • A sale price can carry its own input-token tiers, service-tier rates, decision-endpoint rates, Audio per minute rate, and one-hour cache write rate. It never uses the platform price's service-tier entries: a request whose tier no entry of the sale price names bills at the sale price's base rates.
  • A cache hit still costs 0.
  • The model calls the gateway makes itself while serving a request are billed at the prices of the model each one calls. See Bill the Gateway's Internal Model Calls.
  • A sale price affects recorded cost and budgets only, except a provider key budget, which counts platform cost. least_cost routing still ranks targets by their platform prices.

Bill a Semantic Router's Requests​

A semantic router has no price of its own. A request addressed to it is billed as if the caller had addressed the target the router selected: a route's target, the default target, or a failure target, each a direct model or a model group. The gateway reports that target as route_target_model_id on the request's usage events. The request is then billed at the first of these prices that can bill it:

  1. The sale price of the selected target, with its off-peak discount. When the target is a model group, this is the group's sale price.
  2. The sale price of the model that served the request, such as the group member the group dispatched to, with its off-peak discount.
  3. The platform price of the model that served the request.

Usage billed at the selected target's sale price reports price_source requested_model, shown as Requested model's sale price in the cost breakdown, even though the caller addressed the router.

The router's own model calls, the embedding it compares or the decision it asks for, are billed separately at the price of the model each one calls. See Bill the Gateway's Internal Model Calls.

A gateway released before 1.11.0 does not report the selected target. Its semantic-routed requests are billed at the sale price of the model that served them, then at that model's platform price.

Configure a Sale Price​

To configure a sale price for a direct, embedding, or routing model:

  1. Create or edit the model and expand Sale price (optional).
  2. Select Charge a sale price.
  3. Enter the token rates in the organization's currency. You can also configure input-token tiers and service-tier rates.
  4. Save the model.

The section also supports a One-hour cache write rate, an Audio per minute rate, and the decision-endpoint rates from Decisions prompt through Decisions reasoning. Clear Charge a sale price to remove the sale price. Semantic routers and wildcard aliases do not support sale prices.

In the Admin API, send the rates as the price object of the model, a ModelSalePrice with the same rate fields as an organization price: prompt_per_1m and completion_per_1m are required, and tiers, service_tier_prices, decisions, duration_cents_per_1m_seconds, and cache_write_1h_per_1m are optional. A PATCH with "price": null removes it.

For example, suppose callers address a direct rerank model, rerank-prod, and you resell it at your own rate, with half price overnight in China Standard Time. Set the following price and off_peak on the model:

{
"price": {
"prompt_per_1m": 0.05,
"completion_per_1m": 0
},
"off_peak": {
"timezone": "Asia/Shanghai",
"windows": [{"start": "00:00", "end": "08:00"}],
"multiplier": 0.5
}
}

A rerank request to rerank-prod that completes at 10:00 bills its usage at 0.05 per 1M input tokens. One that completes at 03:00 bills half of that. Both record the serving model's platform price as upstream_cost. An embedding model takes a sale price and off-peak discount the same way. In Cost Analysis, the breakdown lists these requests under Requested model's sale price.

Discount a Sale Price Off-Peak​

A model with a sale price can discount the requests that sale price bills during off-peak hours and on days you list, such as public holidays. An off-peak discount requires a sale price on the same model: it applies to the sale price and to nothing else. An off-peak discount is a set of weekly windows, a set of date ranges, or both, and a multiplier between 0 and 1, exclusive:

  • timezone is an IANA timezone name, and it defaults to Asia/Shanghai.
  • Each window has an inclusive start from 00:00 to 23:59 and an exclusive end from 00:01 to 24:00. 00:00 to 24:00 is a full day.
  • A window whose start is later than its end crosses midnight.
  • weekdays restricts a window to ISO weekdays, 1 for Monday to 7 for Sunday. Omit it for every day. For a window that crosses midnight, weekdays matches the day the window starts: 22:00 to 06:00 on weekdays 1 to 5 covers Friday 22:00 to Saturday 06:00, but not Monday 00:00 to 06:00.
  • Windows may overlap. A request inside any of them is discounted.
  • Each entry in date_ranges has a start and an end date in YYYY-MM-DD form. A range applies all day, from its start date to its end date inclusive, by calendar date in the discount's timezone. For a single day, use the same start and end date. Both must be real calendar dates, the start must not be later than the end, and a discount can list at most 100 date ranges.
  • A request inside any window or on any day of any date range is discounted at the same multiplier. A date range has no multiplier of its own and cannot be limited to certain hours.
  • A discount needs at least one window or one date range, so it can list date ranges only. Responses always return windows, as an empty list when only date ranges are set, and omit date_ranges when there are none.
  • A date range in the past is kept as it is. It is not removed automatically and does not prevent the discount from being saved.

Whether a request is off-peak is decided by when it completed, read in the discount's timezone. There is no built-in holiday calendar: a public holiday is discounted only when you list it as a date range, and a make-up workday is not excluded from the windows.

The multiplier applies to the whole cost that the model's sale price billed, including its tiers and service-tier rates. Every kind of request the sale price bills is discounted, rerank and embedding requests included. A request billed at another model's sale price follows that model's discount, and a request billed at the platform price is not discounted. A cache hit stays free, and least_cost ranking is unaffected.

The rule that a discount needs a sale price is checked on the model as a write would leave it, not on the request. A create or update that would leave the model with off_peak and no price is rejected with 400, so a PATCH that removes only price is rejected while off_peak remains.

The following discount halves the cost of requests that complete between 22:00 and 06:00 starting on a weekday, and all weekend, in China Standard Time:

{
"off_peak": {
"timezone": "Asia/Shanghai",
"windows": [
{"start": "22:00", "end": "06:00", "weekdays": [1, 2, 3, 4, 5]},
{"start": "00:00", "end": "24:00", "weekdays": [6, 7]}
],
"multiplier": 0.5
}
}

A request that completes at 23:00 on Friday, at 05:30 on Tuesday, or at any time on Sunday is discounted. A request that completes at 05:30 on Monday is not: that time belongs to a night that started on Sunday, which the first window does not cover, and the weekend window ends at Sunday 24:00.

The following discount halves the cost of requests that complete between 22:00 and 06:00 starting on a weekday, and at any time from October 1 to October 7, 2026, in China Standard Time:

{
"off_peak": {
"timezone": "Asia/Shanghai",
"windows": [{"start": "22:00", "end": "06:00", "weekdays": [1, 2, 3, 4, 5]}],
"date_ranges": [{"start": "2026-10-01", "end": "2026-10-07"}],
"multiplier": 0.5
}
}

A request that completes at 14:00 on Thursday, October 1, 2026, or at any time on Wednesday, October 7, 2026, is discounted because that day is in the date range. A request that completes at 14:00 on Saturday, October 10, 2026, is not, because that day is in neither the window nor the date range.

In the dashboard:

  1. Configure the model's sale price.
  2. Expand Off-peak discount (optional) and select Discount the sale price off-peak. The option remains unavailable until the model has a sale price.
  3. Set the timezone and multiplier.
  4. Adjust the discount windows. A new discount starts with one daily window from 00:00 to 08:00. To discount only specific dates, remove this window with Remove window.
  5. To add an inclusive date range, select Add date range and set its Start date and End date.
  6. Save the model.

Clear Discount the sale price off-peak to remove the discount. On the In use tab of Model pricing, the Sale prices list summarizes each discount. It lists date ranges after recurring windows and displays a single-day range as one date, for example ×0.3 · 2026-10-01 to 2026-10-07; 2027-01-01 (Asia/Shanghai).

In the Admin API, send the off_peak object on the model. A PATCH with "off_peak": null removes it.

Upgrading to 1.11.0

Before 1.11.0, a routing model could carry an off-peak discount without a group price, and the discount then multiplied its targets' prices. Starting with 1.11.0, a discount applies only to a sale price on the same model:

  • A model group that has an off-peak discount and no sale price no longer gets the discount. Its requests are billed in full at the platform price, so recorded cost and budget spend rise accordingly.
  • Such a model group still loads and is returned with its off_peak as stored. However, every write to it is rejected with 400, including one that changes only its name, targets, or timeout, until the same write sets a price or removes off_peak. AISIX does not remove either one for you. In the dashboard, the model list marks the group with Off-peak not applied: no sale price, and its edit form asks you to set a sale price or turn the discount off before saving.
  • To keep the discount, give the model group a sale price.
  • A model group with both a price and an off-peak discount no longer discounts the requests its price cannot bill: requests on the decision endpoints while it sets no decision-endpoint rate, and requests billed by audio length while its Audio per minute rate is 0. Before 1.11.0, those requests were billed at the target's price with the group's discount applied. They are now billed at the serving model's sale price when it has one that can bill them, otherwise in full at the platform price.
  • A provider key budget counts only platform cost. Spend already counted in the current period is not recalculated, so an amount counted under the earlier rule stays until the period ends.

Bill the Gateway's Internal Model Calls​

While it serves a request, the gateway can call a model itself on the caller's behalf. Gateways and control planes at 1.11.0 or later record each such call as an internal call and bill it. Every internal call names its purpose in internal_call_purpose:

internal_call_purposeThe call
semantic_route_embeddingA semantic router embeds the request's text with its embedding model to compare it with the route examples.
semantic_route_decisionA TypeSafe jev semantic router asks its decision model to pick a route.
semantic_cache_embeddingA semantic cache policy embeds the request to look it up.
guardrail_embeddingA semantic screening guardrail embeds the text it screens, or a custom script guardrail calls aisix.embed.

Each internal call is a usage event of its own. It shares the request's request_id and caller identity, such as the caller API key, member, team, and tags, and names the model it called in model_id and requested_model. See Internal Model Call Events for its fields.

How an Internal Call Is Priced​

An internal call is billed the way a request addressed directly to the model it called would be: at that model's sale price, with its off-peak discount, and otherwise at that model's platform price. The price of the request's own model plays no part.

  • An embedding call is priced as an /v1/embeddings request to the embedding model.
  • A decision call is priced as a /v1/systemone request to the decision model, so the model's decision-endpoint rates apply. A sale price on the decision model bills the call only when it sets at least one decision-endpoint rate.
  • A call to a model with no price records a cost of 0. It is counted as an internal call without platform cost.
  • A semantic router whose classifier names a TypeSafe provider key and model directly, instead of a decision model, makes decision calls that are recorded but not billed. See Reference the Decision Model.

A request answered from the semantic cache still costs 0, but the embedding call that looked it up is billed. A hit on the exact layer makes no embedding call, so it has no internal call.

How Internal Calls Are Counted​

Internal calls are billed usage, but they are not requests:

  • Their cost is included in spend and in platform cost, and is also reported separately. In the Admin API, internal_call_cost and internal_call_platform_cost give that part of cost and platform_cost.
  • Their tokens are not added to the token totals. They are reported separately, as internal_call_prompt_tokens, internal_call_completion_tokens, and internal_call_total_tokens.
  • They are not counted as requests, as successes, or in latency figures.
  • Calls without a platform cost are counted in internal_call_no_platform_cost_count, not in no_platform_cost_attempt_count.
  • They count toward budgets the way the caller's own usage does. The caller API key, team, member, tag, environment, and organization budgets that the request counts toward also count the internal call's billed cost. A provider key budget counts its platform cost under the provider key of the model it called.
  • They do not count toward the caller's rate limits or token-per-minute limits, and an exhausted provider key budget does not stop an internal call.

The Usage view, an environment's Overview page, Cost Analysis, and Request Logs show these figures.

Limits of Internal Call Billing​

  • Realtime sessions. A semantic screening guardrail on /v1/realtime screens inside the upgraded session. Its embedding calls are not recorded as internal calls and are not billed.
  • First request after a change. A semantic router caches the embeddings of its route examples, and a semantic screening guardrail caches those of its examples. After a gateway restart or a configuration change, they are embedded again while the gateway serves the next request that needs them, so that request's internal calls carry their tokens and cost.
  • Earlier gateways. A gateway released before 1.11.0 records no internal calls, so the calls it makes are not billed.

Read Platform Cost and the Price Tier​

A sale price and its off-peak discount change what a request is billed, not what the target model costs you. Each usage event therefore records platform cost and the price tier beside cost. All three fields are frozen when the event is recorded and can be null:

FieldMeaning
upstream_costThe attempt's usage at the dispatched target model's own price, in the organization's currency. The target's service-tier rates and input-token tiers apply. A sale price and its off-peak discount do not, so when the request is billed at the platform price it equals cost. It is 0 on a cache hit, and null when the target has no price.
price_tier_indexThe position, starting at 1, of the tier that produced cost, in the price list that billed the attempt. That list is the sale price's, the target model's platform price's, or a service-tier entry's. It is null when no tier's rates determined the cost: a flat price, a cache hit, no price, a decision-endpoint request, a request billed by audio length, or an attempt with no tokens.
price_tier_max_input_tokensThe inclusive input-token limit of that tier. It is null on the open-ended last tier and whenever price_tier_index is null.

Platform cost covers only usage recorded after the control-plane release that added it. Earlier events keep null in all three fields and are not recalculated.

A CNY organization uses no catalog prices, so a target model the organization has not priced records null. To see platform cost in a CNY organization, add a price for each target model, not only a sale price on the model the caller addresses.

Expanding a row in Request Logs shows Platform cost and Price tier. Exports carry the same three fields. To read platform cost across any grouping instead of billed amounts, see Switch Between Billed Amounts and Platform Cost.

Read the Cost Breakdown to see which input tier, service tier, and off-peak discount billed each part of a cost. A provider key budget accumulates platform cost.

Verify the Override​

For the simplest verification, send a new request directly to the matching model, then expand the event in Request Logs. For a token-priced model, generate enough token usage to produce a visible cost. For a duration-priced model, use an audio sample with a known or sufficiently long duration. Confirm that the event shows the expected model and event cost. Request Logs does not currently display the measured audio duration, so calculate the expected duration cost from the sample length.

If you verify a routed or ensemble request instead, find the event or attempt rows that share its request ID. Add their costs before comparing the total with the expected cost.

Request Logs shows six decimal places. If the expected event cost rounds to zero at that precision, generate enough token usage to make the cost visible at that precision.

After sufficient traffic, you can also confirm aggregate spend in Usage. Usage rounds spend to two decimal places and shows only the top 10 model rows, so it is less reliable for verifying a single low-cost request.

Historical rows do not change after the override is saved. Compare an event created after the change rather than expecting an earlier zero-cost event to be recalculated.

Edit or Reset a Price​

Edit a row to change the rates used for later events. Reset to catalog default removes the organization override. In a USD organization, if a catalog price exists, it takes effect again on the next usage event. In a CNY organization, the pair becomes unpriced.

A manually created duration-pricing row usually has no catalog default. Resetting that row removes its effective price, so later matching events record zero cost until another override is configured.

Next Steps​

Continue with Budgets to enforce spending limits, then configure Budget Alerts and Notifications. Use Logging and Auditing to investigate individual request outcomes.