Kilo Code: custom provider and kilo.jsonc limits

Add uttapen to Kilo Code as an OpenAI Compatible provider, set limit.context and limit.output in kilo.jsonc, and pick a cheap Small Model for titles.

Updated: 22 Sep 2026

Kilo Code version 7 is built on the opencode core and shares one config file across VS Code, JetBrains and the terminal. You add uttapen as a Custom provider. This page was checked against Kilo's official docs for 7.x.

Adding the provider in the UI

  1. Settings (gear) → Providers tab → Custom provider at the bottom of the list.
  2. Fill in the dialog:
FieldValue
Provider IDuttapen (lowercase)
Display nameuttapen
Provider APIOpenAI Compatible
Base URLhttps://api.uttapen.ir/v1
API keyyour sk-up-… key from Dashboard → API keys
  1. Once the URL is valid, Kilo fetches the catalogue from GET /v1/models; pick the models you want from that list and press Submit.

Kilo's docs suggest OpenAI Responses for OpenAI models and Anthropic Messages for Anthropic ones. Don't follow that here: both point at endpoints uttapen doesn't serve. Always choose OpenAI Compatible, including for openai/… and anthropic/… ids.

Output and context limits in kilo.jsonc

The dialog has no token-limit fields; those live in the config file, either ~/.config/kilo/kilo.jsonc globally or kilo.jsonc in the project root.

{
  "$schema": "https://app.kilo.ai/config.json",
  "provider": {
    "uttapen": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "apiKey": "{env:UTTAPEN_API_KEY}",
        "baseURL": "https://api.uttapen.ir/v1"
      },
      "models": {
        "anthropic/claude-sonnet-5": {
          "name": "Claude Sonnet 5",
          "tool_call": true,
          "limit": { "context": 200000, "output": 8192 }
        },
        "openai/gpt-5-nano": {
          "name": "GPT-5 nano",
          "limit": { "context": 400000, "output": 1024 }
        }
      }
    }
  },
  "model": "uttapen/anthropic/claude-sonnet-5",
  "small_model": "uttapen/openai/gpt-5-nano"
}
  • limit.output is sent to us as max_tokens, and Kilo's internal default for it is 32,000. Since uttapen reserves the cost of that ceiling before the request goes out (pricing), a large number locks up your balance for nothing. 8192 is enough for code edits.
  • Leave limit out and both values resolve to zero, which disables automatic context management: the conversation is never compacted and each prompt grows larger and pricier.
  • {env:UTTAPEN_API_KEY} reads the key from the environment, so it never sits in the file.
  • Kilo model names are provider_id/model_id and only the first / separates them, so uttapen/anthropic/claude-sonnet-5 is correct.

Always set a Small Model

Kilo uses the Small Model (the Settings → Models tab, or the small_model key) for session titles, commit messages and prompt enhancement. Leave it empty and Kilo first looks for a cheap model on the same provider; because our custom provider isn't in its built-in catalogue, it either falls back to Kilo's own service or reuses your main model with the same large reservation. Point it at something cheap such as openai/gpt-5-nano or google/gemini-2.5-flash-lite.

For the main model, take ids from the model list: anthropic/claude-sonnet-5 and openai/gpt-5 for heavy work, qwen/qwen3-coder and deepseek/deepseek-v3.2 when cost matters.

Checking that it works

Send a small request from the Kilo panel or the CLI, then look at Dashboard → Usage: you should see two rows, one for the main model and a tiny one for the Small Model.

Troubleshooting

ErrorCause in KiloFix
401 invalid_api_keyThe key isn't stored on the provider, or the environment variable is emptyRe-enter the key in the provider dialog, or export UTTAPEN_API_KEY
404 model_not_foundA hand-typed, wrong model idPick from Kilo's fetched list (the 404 also lists the closest ids it guessed, in uttapen.suggestions)
404 not_foundProvider API is OpenAI Responses or Anthropic MessagesSwitch to OpenAI Compatible
402 insufficient_balanceOversized hold from a missing limit.output, or a low balanceSet limit.output and top up
429The key's rate or monthly limit (rate limits)Wait, or raise the key's limit
"Response may be incomplete" warningThe model hit limit.outputRaise it, or turn reasoning off

If your available balance can't cover the full max_tokens, uttapen trims the output ceiling to fit the balance (never below 1,024 tokens) and returns the granted value in the X-Uttapen-Max-Tokens header — which is when you see Kilo's "response may be incomplete" warning. Only if even 1,024 tokens don't fit do you get 402.

Other tools live in integrations; error codes are in errors.

No API key yet?

Sign up with a phone number, top up your wallet from 100,000 toman and create a key. Free models work without a top-up — up to 50 requests a day. Create an API key →