Autorouting
With autorouting, the router picks the model instead of your client. Pass waibee/auto in the model field instead of a specific ID.
curl https://api.waibee.com/v1/chat/completions \ -H "Authorization: Bearer $WAIBEE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "waibee/auto", "messages": [{ "role": "user", "content": "Reply with one word: ok" }] }'The model field in the response holds the model that actually ran, not waibee/auto:
{ "model": "google/gemini-3.7-flash", "choices": [{ "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "ok" } }], "usage": { "prompt_tokens": 6, "completion_tokens": 75, "total_tokens": 81 }}Autorouting works on all three endpoints: POST /v1/chat/completions, POST /v1/messages, and POST /v1/responses.
A short question goes to a cheap model, a hard task to a strong one, and a request with an image to a model that accepts images. You do not have to watch the catalog or change IDs when new models appear.
What affects the choice
Section titled “What affects the choice”The router looks at the request itself:
| Signal | Effect |
|---|---|
| Text of the request and the system prompt | Estimates how hard the task is: a quick lookup or system design |
| Attachments | An image or audio in the input leaves only models with that modality |
tools | Requires tool calling support |
reasoning_effort or reasoning.effort, or thinking with budget_tokens on /v1/messages | Requires a reasoning model |
response_format (text.format on /v1/responses) | json_schema requires structured outputs support, and json_object requires response_format support |
cache_control markers | Leaves only models that understand cache_control, currently Anthropic models |
| Request size | Drops models whose context window is too small |
The router picks among the models your group allows for autorouting. This is a separate setting: autorouting can pick a model you cannot request by name, and the other way around.
If autorouting is available to your group, waibee/auto is in the catalog.
Stability within a conversation
Section titled “Stability within a conversation”The router recognizes a continuing conversation by its content and tries to keep the model it picked for it. It can switch models, for example when the conversation no longer fits that model’s context window.
This matters most with cache_control markers: the cache is held by a specific model, and switching to another one would reset cache hits. See Prompt caching.
Errors
Section titled “Errors”Selection errors apply only to waibee/auto and come with status 422.
| Code | When |
|---|---|
auto_routing_no_match | No suitable model is left after filtering by capabilities and policies |
auto_routing_request_too_large | The request does not fit the context window of any available model |
auto_routing_caching_unavailable | Prompt caching was requested, but no suitable model supports it |
auto_routing_missing_context | Internal selection error: retry the request, and if it happens again, contact support |
The details of the rejection are in extra (in details on /v1/messages and /v1/responses): which filter emptied the list of models, which capabilities were required, and what to do about it.
{ "error": { "code": "auto_routing_request_too_large", "message": "No model matches the auto-routing requirements", "extra": { "required_capabilities": [], "filter_step_dropped_at": "context", "pool_size_initial": 73, "pool_size_after_filter": 0, "recommendation": "The request is too large...", "auto_routing_decision_id": "e0e62376-55c2-4e06-98cb-90dc6640d451", "tier_attempted": "standard" } }}If you get these errors regularly, specify the model explicitly; see Models. Include auto_routing_decision_id when you contact support.
waibee/auto requires a minimum balance. Below it, the request is rejected with 402 and the code insufficient_funds, and message names the amount required. Top up your balance or specify the model explicitly.
What to keep in mind
Section titled “What to keep in mind”- The cost of a request depends on the model picked. Calculate it from the
modelandusagepair in the response; see Tokens and usage. - Where you need reproducible results, specify the model explicitly. Tests, benchmarks, prompt comparisons, and a prompt tuned for a specific model only make sense on a fixed model.