Auto Model Routing
Set the model to auto and BLACKBOX AI picks a closed, big open-weight or small open-weight model for every request, based on what the request needs.
Coding agents make one model call per step, and most steps (listing files, rerunning a test, reading output) do not need a closed model. With model: "auto", BLACKBOX AI reads each request, decides which tier of model the step needs, and serves it with that model. Hard steps go to a closed model; moderate and routine steps go to lower-cost open-weight models.
Routing is decided per request. Agents resend the full conversation on every turn, so whichever model handles a step sees everything earlier steps did.
Quick start
Use the model ID blackboxai/auto (or simply auto) with any supported endpoint. Everything else in the request stays the same.
curl https://enterprise.blackbox.ai/chat/completions \
-H "Authorization: Bearer $BLACKBOX_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "blackboxai/auto",
"messages": [
{"role": "system", "content": "You are a coding agent."},
{"role": "user", "content": "The date parser test fails. Find and fix the bug."}
]
}'import os
import openai
client = openai.OpenAI(
api_key=os.environ.get("BLACKBOX_API_KEY"),
base_url="https://enterprise.blackbox.ai",
)
response = client.chat.completions.with_raw_response.create(
model="blackboxai/auto",
messages=[
{"role": "system", "content": "You are a coding agent."},
{"role": "user", "content": "The date parser test fails. Find and fix the bug."},
],
)
print(response.headers.get("x-blackbox-routed-model")) # the model that served this step
print(response.parse().choices[0].message.content)import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.BLACKBOX_API_KEY,
baseURL: "https://enterprise.blackbox.ai",
});
const { data, response } = await client.chat.completions
.create({
model: "blackboxai/auto",
messages: [
{ role: "system", content: "You are a coding agent." },
{ role: "user", content: "The date parser test fails. Find and fix the bug." },
],
})
.withResponse();
console.log(response.headers.get("x-blackbox-routed-model")); // the model that served this step
console.log(data.choices[0].message.content);To route a coding agent, set its model to blackboxai/auto and its base URL to https://enterprise.blackbox.ai. No other change is needed.
Supported endpoints
| Endpoint | Request format |
|---|---|
/chat/completions, /v1/chat/completions |
OpenAI Chat Completions |
/v1/responses |
OpenAI Responses |
/v1/messages |
Anthropic Messages |
Once the model is chosen, the request continues through the normal pipeline as a request to that model, including tool calls and safety checks.
Model tiers
Each request is served by one of three tiers:
| Tier | x-blackbox-route-tier |
Used for | Model example |
|---|---|---|---|
| Closed | closed |
Hard steps: diagnosing a non-obvious bug, multi-file design, recovering after repeated failures | GPT-6 Astra |
| Big open-weight | open_big |
Moderate steps: writing code with a clear plan, interpreting a normal error | Kimi K3 |
| Small open-weight | open_small |
Routine steps: navigating the repository, reading a file, rerunning a command, submitting | Nemotron 3.5 Lightning |
Which model served the request
Every routed response carries three headers:
| Header | Value |
|---|---|
x-blackbox-routed-model |
The model that served this request, for example kimi-k3 |
x-blackbox-route-tier |
The tier identifier: closed, open_big (big open-weight) or open_small (small open-weight) |
x-blackbox-route-source |
How the tier was chosen: decision1 (the router) or default (fallback) |
How the decision is made
For each request, BLACKBOX AI builds a short summary of the agent's state: the task, the most recent messages and tool output, and counters such as the turn number and how many commands have failed so far. Microsoft Decision-1 answers a fixed set of yes/no questions about that state in a single call (for example, "Did the last command fail?" or "Will the next action edit source code?"), and a small learned model turns the answers into a tier. A routing decision typically adds under a second.
On held-out evaluations across coding agents including Claude Code, Codex, Gemini CLI, OpenHands and SWE-agent, the router picks the same tier as a GPT-6 Astra judge 70 to 80% of the time. See Blackbox AI Router, Powered by Microsoft Decision-1, Outperforms Claude Opus 5.5 on Terminal-Bench for the full evaluation.
Reliability
Routing never fails a request. If the router cannot decide in time or is unavailable, the request is served by the big open-weight tier (Kimi K3), and x-blackbox-route-source is default.
Best practices
Send the full conversation on every request, including tool calls and tool results. The router reads the most recent tool output and the agent's progress to decide whether a step is routine or hard.
- Use it for multi-step agents. The savings come from routine steps, which make up most of a coding agent's calls.
- Pin a model when you need one. If a request must be served by a specific model, send that model ID instead of
auto. - Log the routing headers. Recording
x-blackbox-routed-modelper request shows how your traffic is split across tiers.