Kilo Code errors: 401, model not found and the /v1 address

Coding with AIKilo Code·· 9 views· 4 min read

Almost every Kilo Code error with All in One AI comes from the key, the model id or the address. Here are the API answers, the Kilo Code messages and what to do in each case.

401: the key

Kilo Code may show "Invalid API Key". The key is missing or wrong, or Kilo Code did not read it.

Where Why What to do
Extension The key was pasted incomplete or with spaces. Paste it again in API key.
Command line The variable does not exist in the window where you started kilo. After setx, open a new terminal and run kilo again.
Command line The provider is in the project's kilo.jsonc, which does not read {env:...}. Move it to the global file: see why the key only works in the global file.

404 model_not_found: the model

The id is wrong, incomplete (missing the part before the slash) or is not a text model. Use the id with the slash, as it comes in GET /v1/models. In kilo.jsonc, the key inside models is the catalogue id, and model is api/ plus that id.

If the model does not even show in the picker, the Kilo Code documentation says to check the key, check that the name matches the provider/model format and run kilo models.

The ids are in the Models tab of All in One AI or in the API list. On Linux and macOS:

curl "https://api.mozout.co.mz/v1/models?type=text" -H "Authorization: Bearer $MOZOUT_API_KEY"

In Windows PowerShell:

curl.exe "https://api.mozout.co.mz/v1/models?type=text" -H "Authorization: Bearer $env:MOZOUT_API_KEY"

Each model comes with its id (always with the slash), its context_length and its price in pricing. Listing the models spends no credits.

404 not_found: the address with /v1

The Base URL (or baseURL in the file) must be https://api.mozout.co.mz/v1. Kilo Code adds /chat/completions. Without /v1, the API answers 404 not_found. Kilo Code also accepts the full address, ending in /v1/chat/completions.

The address without /v1 is only for Claude Code. If there is no answer at all, check the address and your internet connection.

Other answers

Answer Why What to do
402 insufficient_credits There are not enough credits for the reservation of the answer. Buy credits or lower limit.output. Without it, Kilo Code asks for 32,000 tokens: see limits in kilo.jsonc.
403 insufficient_scope The key does not have ai:read or ai:write. Create a key with both.
429 plan_limit_reached The Coding Plan points ran out and the request cannot be paid with credits. See Kilo Code and the Coding Plan.
429 rate_limited You went over the key's limit of requests per minute. Wait the number of seconds in Retry-After.
502 upstream_error The AI service did not respond as expected. Try again shortly or choose another model.

It answers but does not edit files

The model does not support tools, or "tool_call": true is missing in kilo.jsonc. See models that accept tools.

Every error answer has a correlation_id. If you need help, open a support ticket with that code, the tool and the model, without the key.

Want Kilo Code to work the first time? Visit the Coding with AI page.

See Coding with AI

SEE ALSO

Errors when setting up a tool with All in One AI: 401, model not found, no credits, /v1 and rejected config files

Why the key only works in the global kilo.jsonc, and not in a project's file

Context and output limits in kilo.jsonc

Checking Kilo Code with a sandbox_ key before you work

Coding with AI in All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from 396,00 MT/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.