Roo Code is one of the few VS Code coding agents that lets you bind a named API profile to a specific mode, and it is unusually strict about how it talks to a model: native tool calling only, no XML fallback. That combination makes it a good stress test for a gateway, and it means a Roo Code OpenAI-compatible API setup is either clean in three fields or broken in a way the error message rarely explains.
This post is AtmoRouter-authored and covers the OpenAI Compatible provider path only. It describes what the extension actually sends, the settings that change behaviour, and illustrative cost math from today's catalogue. No benchmark claims, no invented users.
What the OpenAI Compatible provider actually sends
Roo's own documentation is blunt: tool definitions go out in OpenAI's native tools schema, tool calls stream back as dedicated events with the arguments arriving incrementally, and there is no XML-based fallback. A model that cannot do OpenAI-compatible function calling cannot drive Roo's edit loop at all.
That is the first filter on your model list, ahead of price or context length. Models that write excellent code but emit tool calls as text will fail here, and the failure looks like a gateway bug when it is a capability mismatch. Roo edits files through those tool calls, so output tokens scale with the size of the code it writes, not with the number of messages you send.
Connect AtmoRouter in four fields
Click the gear icon in the Roo Code panel and stay on Providers.
- 1.API Provider:
OpenAI Compatible— notOpenAI, which hardcodesapi.openai.com. - 2.Base URL:
https://atmorouter.dev/v1 - 3.API Key: your key (
ar-xxxxxxxxxxxx) - 4.Model: the exact catalogue ID, family prefix included
Roo appends the request path itself, so the base URL stops at /v1. Paste the full /chat/completions endpoint and you get a doubled path and a 404. The model field needs an exact ID too: zai/glm-5.3, not glm-5.3.
Read the catalogue instead of trusting any table, including the ones below:
bashcurl -s https://atmorouter.dev/v1/models \
-H "Authorization: Bearer $ATMOROUTER_API_KEY" \
-o /tmp/atm-models.json
jq -r '.data[0] | keys' /tmp/atm-models.json
jq -r '.data[] | [.id, .pricing.input, .pricing.output, .context_length] | @tsv' /tmp/atm-models.json \
| sort -t$'\t' -k2 -g | head -15The first jq prints the keys so you are not guessing at field names; the second prints each ID with its from-price per million input and output tokens and its context window, cheapest first. Each model also carries a price_tiers array, because one model can have several price tiers. Save the profile, then start a new task so the new settings are in play.
Fill Model Configuration or Roo misjudges your window
Roo cannot infer limits for an arbitrary alias, so the Model Configuration block is manual: Max Output Tokens, Context Window, Image Support, Computer Use, Input Price, Output Price. Set Context Window to the model's real window from the catalogue. Too small and long conversations truncate early; too large and tasks die on upstream context errors.
Those numbers also drive context management. Roo reserves 30% of the window by default — 20% for output, 10% as a safety buffer — leaving 70% for history, and intelligent context condensing fires at the threshold you configure. Condensing is itself a model call billed at the active rate, so a long session pays for summaries as well as edits. Count it as a real cost line, not overhead.
Input Price and Output Price only feed Roo's local cost display. Copy the per-million rates off the model page and treat the extension's number as an estimate: AtmoRouter bills per request and logs tokens and latency per request, which is what you reconcile against at the end of the week.
Cost math for one Roo task
Assume, illustratively, a 12-request refactor task: 18,000 billed input tokens per request (216,000 total), 9,000 output tokens, and 60% of input served from cache at 10% of the input rate.
| Model | Context | From price (in / out) | Est. per task | 500 tasks | | --- | --- | --- | --- | --- | | zai/glm-5.3 | 1M | $0.0035 / $0.011 | $0.00045 | $0.22 | | alicn/deepseek-v4.1-flash | 1M | $0.043125 / $0.1725 | $0.0058 | $2.92 | | grok/grok-4.6 | 500k | $0.095 / $0.285 | $0.0120 | $6.00 | | alicn/kimi-k2.7-code | 262k | $0.285 / $1.2 | $0.0391 | $19.56 |
The middle row, worked out:
pythonIN, OUT = 0.043125, 0.1725 # alicn/deepseek-v4.1-flash from-prices
inp, out, cache_share = 216_000, 9_000, 0.60
cached = inp * cache_share
cost = ((inp - cached) * IN + cached * IN * 0.10 + out * OUT) / 1e6
print(f"${cost:.4f}") # $0.0058These are from-prices, the lowest listed tier. A request can be served at any listed tier unless you cap it, and the bill uses the rates of the offer that actually served it, so treat each row as a floor. Read the table as a shape, not a quote sheet. Average context per request moves these rows far more than turn count does: a 1M-token window is not an invitation, and at 400k of history you pay for 400k on every request. Rates refresh continuously and the model page is authoritative; cached input bills at 10% of the input rate where the model supports it.
Give each mode its own model with profiles
API Configuration Profiles are why this setup is worth more than five minutes. The + next to the profile selector creates a named profile with its own provider, key, model, temperature, thinking budget and rate limit (minimum seconds between requests). In the Prompts tab you can bind a profile to a mode, and modes keep sticky models, so Orchestrator, Architect, Code and Debug can each run a different price point without reconfiguring anything.
A pattern that holds up:
- Architect and Debug on a mid-price model with a large window.
- Code on whatever passes your tool-calling test at the lowest rate.
- Ask on the cheapest model in the catalogue.
Then set maximum input and output prices in AtmoRouter's Budgets so a profile cannot silently drift into an expensive tier. Budgets cap routing; they do not replace a price field you forgot to update.
When tool calls fail: what actually breaks
- Model Not Found — the ID is not exact. Copy it from
/v1/models. - Invalid API Key — paste the raw key; Roo adds the
Bearerheader itself. - Tool-calling errors — the model does not support native tools, or implements the schema partially. Switch models.
- Connection errors — base URL wrong, or
/v1appears twice. - Truncated or empty replies mid-task — Context Window set too high, Max Output Tokens too low to cover reasoning plus visible text, or a condensing threshold that fires too aggressively.
FAQ
Should I pick "OpenAI" or "OpenAI Compatible" in Roo Code?
OpenAI Compatible. The OpenAI provider targets OpenAI's own API; the compatible provider is the one that takes a custom Base URL such as https://atmorouter.dev/v1.
Which AtmoRouter models work with Roo Code?
Any model that handles OpenAI-style native tool calling reliably. Roo has no XML fallback, so run one real edit task on a candidate before you bind it to Code mode.
Does Roo Code's cost display match my AtmoRouter bill?
Only if the Input Price and Output Price fields match the tier that served each request. Treat Roo's number as an estimate and reconcile against the per-request logs in your AtmoRouter dashboard.
Does context condensing cost extra?
Yes. Roo's docs note that the summarization call itself incurs a cost, so long sessions pay for summaries on top of edits.
Next step
Create a key on atmorouter.dev, pick a model from the live model list, and run one real Roo task on a cheap model before you roll the profile out to a team. Using another client too? The Cline, Continue.dev and Zed guides use the same base URL, key and model fields.