
A common case: you put the Interweb provider in the project's kilo.jsonc, with "apiKey": "{env:INTERWEB_API_KEY}", and Kilo Code behaves as if there were no key. The setup is not wrong. Kilo Code does not read variables in project files, on purpose.
The rule
Kilo Code only replaces {env:...} in configuration it trusts: the global file (in ~/.config/kilo/), a file given in the KILO_CONFIG or KILO_CONFIG_CONTENT variables, and configuration managed by your organisation. In a project's kilo.jsonc or opencode.json, the reference is ignored and Kilo Code writes a warning in its log.
The reason: a project file can come from any repository. This way, a repository you cloned cannot read your key.
What happens in practice
The provider has no key and the requests fail with 401. Kilo Code may show "Invalid API Key".
The fix
|
|
|
|
The full provider block is in the article on the global kilo.jsonc file.
What about writing the key in the project file?
Do not do it. The Kilo Code documentation itself warns that these files must not hold keys (provider.*.options.apiKey), because they usually go into the repository, and tells you to use environment variables.
Kilo Code accepts {file:...} in a project file, but only for files inside the project folder, which is the one that goes to Git. So it is no good for the key either.
| OpenCode is different: its project file reads variables and can go into the repository. See sharing an OpenCode setup without sharing the key. |
|
Want Kilo Code with your key kept safe? Visit the Coding with AI page. See Coding with AI |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from $6.59/mo (3-year plan, with coupon) See plans |











