Guide

Kilo Code With an OpenAI-Compatible API: AtmoRouter Setup Guide

Set up Kilo Code with an OpenAI-compatible API on AtmoRouter: custom provider fields, kilo.jsonc model limits, token cost math, and fixes for common errors.

This is an AtmoRouter-authored guide. Kilo Code is one of several VS Code coding agents that will talk to any endpoint speaking the OpenAI Chat Completions API, and setting up a Kilo Code OpenAI compatible API connection takes about two minutes once you know which fields matter. Below is the exact configuration for pointing Kilo Code at AtmoRouter, the one settings trap that silently breaks long sessions, and some illustrative cost math. It is not a benchmark, and it will not claim Kilo Code is better or worse than any other agent.

What Kilo Code needs from a gateway

Kilo Code's docs describe a Custom provider dialog with seven fields: Provider ID, Display name, Provider API, Base URL, API key, Models, and optional Headers. For a gateway like AtmoRouter, three of those do the real work:

  1. 1.Provider API must be OpenAI Compatible. Kilo's docs reserve OpenAI Responses for OpenAI and xAI models and Anthropic Messages for Anthropic and MiniMax models, so picking the wrong protocol fails on request shape rather than on authentication, which makes it look like a key problem.
  2. 2.Base URL is the OpenAI-style prefix ending in /v1. For AtmoRouter that is https://atmorouter.dev/v1. Kilo also accepts full endpoint URLs such as /v1/chat/completions, but for a standard gateway the prefix form is the right one.
  3. 3.API key is your AtmoRouter key (ar-xxxxxxxxxxxx).

Once a valid Base URL and key are in place, Kilo queries the provider's models endpoint and shows a searchable, fuzzy-matched picker. If the list does not appear, there is a Fetch models button to retry, and you can always type model IDs by hand. Model IDs on AtmoRouter include a family prefix, for example zai/glm-5.4 or cc/claude-sonnet-5-5, and the picker sends them unchanged.

Step 1: add the provider in the UI

  1. 1.Open Settings (the gear icon) and go to the Providers tab.
  2. 2.Scroll to the bottom of the provider list and click Custom provider.
  3. 3.Fill in the dialog:

- Provider ID: atmorouter (lowercase letters, numbers, hyphens or underscores; no slashes) - Display name: AtmoRouter - Provider API: OpenAI Compatible - Base URL: https://atmorouter.dev/v1 - API key: your AtmoRouter key - Models: pick from the auto-fetched list, or add IDs manually

  1. 1.Click Submit. The models now show up in the model picker as atmorouter/<model id>.

Select one of the new models and send a short prompt. If the reply arrives, the connection works end to end.

Step 2: pin model settings in kilo.jsonc

The UI dialog covers connection details. Token limits, tool-calling flags, and cost figures live in the kilo.jsonc config file, which Kilo's docs show under provider.<provider_id>.models. A config that mirrors the UI step above and adds two models looks like this:

jsonc{
  "$schema": "https://app.kilo.ai/config.json",
  "model": "atmorouter/glm-5-4",
  "provider": {
    "atmorouter": {
      "options": {
        "apiKey": "{env:ATMOROUTER_API_KEY}",
        "baseURL": "https://atmorouter.dev/v1"
      },
      "models": {
        "glm-5-4": {
          "id": "zai/glm-5.4",
          "name": "GLM-5.4 (AtmoRouter)",
          "tool_call": true,
          "cost": { "input": 0.0035, "output": 0.011 },
          "limit": { "context": 1000000, "output": 131072 }
        },
        "sonnet-5-5": {
          "id": "cc/claude-sonnet-5-5",
          "name": "Claude Sonnet 5.5 (AtmoRouter)",
          "tool_call": true,
          "cost": { "input": 0.135, "output": 0.675 },
          "limit": { "context": 1000000, "output": 128000 }
        }
      }
    }
  }
}

Three things in that file deserve attention:

  • The `id` field is what gets sent to the provider. The key (glm-5-4) is just the name you select in Kilo; id carries the real catalogue ID with its prefix. Per Kilo's docs, id defaults to the config key, so set it explicitly whenever the real catalogue ID differs from the key.
  • `limit.context` and `limit.output` are not cosmetic. Per Kilo's docs, an unknown model with no limits resolves both to 0, which disables compaction, so the conversation grows until the provider rejects it. Output then falls back to 32,000 tokens. Set both to the model's real values from the AtmoRouter model page.
  • `cost` is what Kilo uses for its own cost display. Copy the current input and output rates from the model page when you add a model, and refresh them when prices change.

One security note from the same docs: {env:VAR} references only resolve in trusted config, such as your global config under ~/.config/kilo. A project-level kilo.json committed to a repository cannot resolve environment variables, so keep the AtmoRouter key in your global config, not in the repo.

Step 3: pick a model and check the request

Kilo resolves the active model in this order: the --model (-m) command-line flag, the model key in the config file, the last used model from the previous session, then the first available model. All of them use the provider_id/model_id format. Running kilo models lists everything Kilo currently sees, which is a quick way to confirm the provider authenticated.

If you want to see the raw request the agent is making, the same call with curl is:

bashcurl https://atmorouter.dev/v1/chat/completions \
  -H "Authorization: Bearer $ATMOROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai/glm-5.4",
    "messages": [{"role": "user", "content": "Reply with the single word: ok"}]
  }'

A JSON response with a usage object means the key, base URL, and model ID are all correct. If this works but Kilo Code does not, the problem is in Kilo's provider config, not in the gateway.

What a coding task costs (illustrative)

Coding agents bill mostly on input, because every tool call resends the conversation. The table below uses a made-up but typical task: 12 requests, averaging 30,000 input and 1,200 output tokens each, so 360,000 input and 14,400 output tokens in total. Prices are AtmoRouter "from" rates in USD per million tokens at the time of writing; the model page is authoritative and rates change, so re-check before you budget.

| Model | From price (input / output per 1M) | Context / max output | Per task | Per 1,000 tasks | |---|---|---|---|---| | mm/MiniMax-M3 | $0.00075 / $0.003 | 1,000,000 / 524,288 | ~$0.0003 | ~$0.31 | | zai/glm-5.4 | $0.0035 / $0.011 | 1,000,000 / 131,072 | ~$0.0014 | ~$1.42 | | cc/claude-sonnet-5-5 | $0.135 / $0.675 | 1,000,000 / 128,000 | ~$0.058 | ~$58 | | cx/gpt-6.2-sol | $0.25 / $1.25 | 628,000 / 128,000 | ~$0.108 | ~$108 |

Input is roughly 95 to 99% of each bill here. That is why the limit.context setting matters: a model with a one-million-token window and working compaction lets you finish a task in fewer, fuller sessions, and why a cheaper model is often better used for bulk edits while a stronger one handles the hard turns.

Cached input is billed at 10% of the input rate on models that support it. If 80% of the 360,000 input tokens were cache hits, the Sonnet-class row would drop from about $0.058 to about $0.023, and the GLM row from about $0.0014 to about $0.0005. That is arithmetic, not a promise: whether hits happen depends on the model and on how much of the prompt prefix stays identical between requests.

Two billing facts worth knowing about AtmoRouter: it is a prepaid balance with no seat fees, and failed requests are never billed, so a misconfigured provider costs you nothing while you debug it.

Troubleshooting

"Invalid API key"

Check the key in the provider entry, and confirm the provider API is set to OpenAI Compatible. The wrong protocol often surfaces as an auth-looking error.

"Model not found"

Use the exact ID from the auto-fetched list or the AtmoRouter model page, including the prefix. If you typed it by hand, compare it character by character; the id field in kilo.jsonc is what Kilo sends.

No models appear in the picker

Click Fetch models after fixing the base URL or key. Confirm the URL is https://atmorouter.dev/v1 with no trailing path, then run kilo models to see whether the provider is listed at all.

The model works for a while, then requests fail on long sessions

Set limit.context and limit.output in kilo.jsonc. With limits at 0, compaction is off and the conversation grows until the provider rejects it.

{env:...} is ignored

Environment references only resolve in trusted config such as your global config under ~/.config/kilo. Move the key out of any project-level config file.

FAQ

Does Kilo Code work with any OpenAI compatible API?

Yes, as long as the endpoint speaks the OpenAI Chat Completions format. Choose OpenAI Compatible as the Provider API, enter a Base URL ending in /v1, and add your key. AtmoRouter's endpoint is https://atmorouter.dev/v1.

Which AtmoRouter model should I use in Kilo Code?

For bulk edits and long agent loops, a low-cost model such as zai/glm-5.4 keeps input-heavy sessions cheap. For harder reasoning turns, switch to a stronger model such as cc/claude-sonnet-5-5. You can define both in kilo.jsonc and change models per task.

Why does Kilo Code stop working in long sessions with a custom model?

If limit.context and limit.output are not set and the model is not in Kilo's built-in catalogue, both resolve to 0 and compaction is turned off. Set both to the real values shown on the AtmoRouter model page.

Where should I store my AtmoRouter API key for Kilo Code?

In your global config under ~/.config/kilo, referenced as {env:ATMOROUTER_API_KEY}. Project-level config files committed to a repository cannot resolve environment variables.

Next step

Create a key on the API Keys page, add the provider as above, and compare the models in the catalogue to decide which one handles your daily edits. If you use other editors alongside Kilo Code, the Cline setup guide and the Continue.dev setup guide use the same base URL and key.

Older

Codex CLI Custom Provider Setup With AtmoRouter (Responses Bridge)

Build with AtmoRouter.