Before you begin
Check whether your model has a price range. InGET /v1/models, a row of the model’s pricing that has a max_price next to its price is a range. For example, openai/gpt-6.1-sol costs between 0.0000025 and 0.000005 credits per output token:
max_price costs the same on every provider, so a limit changes nothing for it.
Choose how to limit the price
NagaAI offers two ways to limit the price. Use one of them:
A limit removes providers. When none of the model’s providers fits, NagaAI tries your fallback models; without them, the request fails. See Troubleshooting.
Use only base-price providers
-
Add
service_tier: "flex"to a Responses or Chat Completions request. -
Send the request:
output_text holds the model’s text. The request is billed at the base price. Any other service_tier value, or none, lets every provider serve the request.
Set a price cap
- In the model’s
pricing, find the meter to cap, such asoutput_token. The routing object lists every meter. - Add
routing.max_pricewith the meter and the most one unit may cost, in credits, as a decimal string. - Send the request:
- Responses
- Chat Completions
- Messages
routing through extra_body, because routing is a NagaAI field.
A meter the model doesn’t price is skipped, so one cap can serve several models.
Cap the price of an image, video, or audio request
Image, video, speech, transcription, embeddings, moderation, and rerank requests takerouting.max_price the same way. Cap the meter that the model’s pricing names, such as output_image_token for an image model:
output_video_second is checked against the price of the clip you asked for before anything is spent. Image edits and audio uploads are forms; the OpenAI SDKs send extra_body there as parts such as routing[max_price][input_audio_hour].
Troubleshooting
400: no provider serves this request within its price limit
None of the model’s providers, and none of your fallback models, is within the limit. The message names the model:
routing.max_price to the model’s max_price, drop service_tier: "flex", or add a fallback model in your price.
400: unknown meter
The cap names a meter that NagaAI doesn’t know, such as output_widget. Use a meter from the model’s pricing; The routing object lists every error of routing with its message.
The request cost more than the base price
The model has a range, and the request had no limit. Check that the request sendsservice_tier: "flex" or routing.max_price. In the OpenAI Python SDK, routing goes in extra_body.
See also
- The routing object: every field and meter of
routing. - Routing: how NagaAI orders providers and falls back to other models.
- Billing: what a request costs and when you’re charged.