Set Model Price Override
PUT /model_pricing
PUT /model_pricingInteractive request editor loads with JavaScript.
Authorization
BearerAdminToken Organization-scoped admin token. Read operations require a valid token, and write operations require a token with write permission.
In: header
Request Body
application/json
Full replacement of the organization's price for one (provider,
model) pair. Omitted rates are stored as 0, not left at their
previous value.
Response Body
application/json
application/json
application/json
application/json
curl -X PUT "$AISIX_CP/model_pricing" \ -H "Authorization: Bearer $AISIX_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "provider": "string", "model_name": "string" }'Stored
{
"model_pricing": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",
"provider": "string",
"model_name": "string",
"prompt_cents_per_1m": 0,
"completion_cents_per_1m": 0,
"cache_read_cents_per_1m": 0,
"cache_write_cents_per_1m": 0,
"reasoning_cents_per_1m": 0,
"duration_cents_per_1m_seconds": 0,
"source": "user",
"effective_from": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}
}Request body or parameters failed validation.
{
"error": {
"code": "string",
"message": "string"
}
}Missing or invalid bearer.
{
"error": {
"code": "UNAUTHENTICATED",
"message": "no org context"
}
}Authenticated request is not permitted.
{
"error": {
"code": "CUSTOM_KEY_DISABLED",
"message": "custom API key values are disabled for this organization"
}
}Complete operation details and schema variants
PUT /model_pricing
Set Model Price Override
Set this organization's price for one (provider, model) pair, creating the override or replacing the existing one.
Every rate is replaced, not merged: a rate you omit is stored as
0, which means the token class bills at the prompt or
completion rate rather than keeping whatever it was before. Send
the full set you want in effect.
The new price applies to telemetry arriving after the write —
already-recorded costs are not recomputed — and is republished to
the gateways immediately so least_cost routing ranks on it.
Parameters
Request body
Content type: application/json
provider(string, required):model_name(string, required):prompt_cents_per_1m(integer, optional):completion_cents_per_1m(integer, optional):cache_read_cents_per_1m(integer, optional):cache_write_cents_per_1m(integer, optional):reasoning_cents_per_1m(integer, optional):duration_cents_per_1m_seconds(integer, optional):
Responses
-
200: Stored -
model_pricing(object, required): The price one (provider, model) pair bills at for this organization. All token rates are integer cents per 1,000,000 tokens. -
model_pricing.id(string, required): Price row id. Pass it to the delete endpoint to drop an override; catalog rows cannot be deleted. -
model_pricing.org_id(string, optional): Organization that owns this override. Omitted on catalog rows, which belong to no organization. -
model_pricing.provider(string, required): -
model_pricing.model_name(string, required): -
model_pricing.prompt_cents_per_1m(integer, required): Input token rate. -
model_pricing.completion_cents_per_1m(integer, required): Output token rate. -
model_pricing.cache_read_cents_per_1m(integer, required): Rate for tokens read from an upstream prompt cache.0means no distinct rate — those tokens bill at the prompt rate. -
model_pricing.cache_write_cents_per_1m(integer, required): Rate for tokens written into an upstream prompt cache.0means no distinct rate. -
model_pricing.reasoning_cents_per_1m(integer, required): Rate for reasoning tokens.0means no distinct rate — they bill at the completion rate. -
model_pricing.duration_cents_per_1m_seconds(integer, required): Cents per 1,000,000 seconds, for models billed by audio length rather than tokens.0means not billed by duration. Operator-set only: the catalog carries no audio prices. -
model_pricing.source(string, required): Where the price came from.useris this organization's own override. The other two are catalog defaults and are mutually exclusive per deployment:models.devwhen the control plane syncs the catalog online,snapshotwhen it seeds the catalog from a local file instead — which is what an air-gapped or offline installation does. -
model_pricing.effective_from(string, required): -
model_pricing.updated_at(string, required): -
400: Request body or parameters failed validation. -
error(object, required): Error details. -
error.code(string, required): Machine-readable identifier. Examples:UNAUTHENTICATED,INVALID_REQUEST,MASTER_KEY_UNSET,INTERNAL. -
error.message(string, required): Human-readable explanation; safe to surface to operators. -
401: Missing or invalid bearer. Response fields (application/json): identical toPUT /model_pricing, response 400 above. -
403: Authenticated request is not permitted. Response fields (application/json): identical toPUT /model_pricing, response 400 above.
cURL
curl -X PUT '$AISIX_CP/model_pricing' -H 'Authorization: Bearer $AISIX_TOKEN'