Skip to main content
Kode reads a set of environment variables at startup to configure its LLM backend, resolve file paths, and control interactive behavior. You can set these in your shell profile, a .env file at your project root, or in your CI/CD pipeline. Where a variable overlaps with a field in .kode/kode.json, the environment variable takes precedence for API keys and endpoint overrides.

LLM & API keys

string
The primary API key for the configured LLM provider. This takes precedence over all other key variables (OPENAI_API_KEY, KODE_PRO_API_KEY). Set this when using the Kode Gateway or any provider that accepts a Bearer token via a single key.
string
Standard OpenAI API key. Kode uses this as a fallback when KODE_LLM_API_KEY is not set and no other key is provided. If you are already exporting this variable for other tools, Kode picks it up automatically.
string
Kode Pro API key. When this is set and no other key or endpoint overrides are present, Kode bypasses the public gateway and routes directly to api.deepseek.com using the deepseek-v4-flash model. This is the fastest zero-config path for Pro subscribers.
string
default:"https://api.openai.com/v1"
The LLM API endpoint Kode sends chat completion requests to. Override this to point at a local model server, a corporate proxy, or a self-hosted inference endpoint. The value must be a base URL; Kode appends /chat/completions automatically.
string
default:"gpt-4o"
Override the model Kode uses, bypassing the model field in kode.json. Use the same provider/model format as the config file, or a bare model name when pointing at a local endpoint.

TUI & paths

string
default:"~/.kode/tui"
Custom path for the TUI bundle directory. On first run, Kode downloads the TUI bundle (~52 MB) from GitHub Releases and extracts it to ~/.kode/tui. Set this variable to use a different location — useful when ~ is on a slow filesystem or when you want to share a pre-extracted bundle across users.
string
Custom URL to download the TUI bundle archive from. When set, Kode fetches the tui-bundle.tar.gz from this URL instead of GitHub Releases. Use this to point at an internal mirror or a pinned artifact in air-gapped environments.
string
default:".kode"
Override the path Kode uses for the .kode config directory. By default Kode looks for .kode/kode.json in the current working directory. Set KODE_DIR to use a directory at a different absolute path — for example, a shared config location on a build server.
string
Set to 1 to disable all automatic install prompts. When Kode detects that a dependency (Bun, the TUI bundle, or Sicario) is missing and this variable is set, it fails immediately instead of asking to install. Always set this in CI to prevent pipelines from hanging on interactive prompts.
string
Override the path to the Sicario SAST binary. Kode normally installs Sicario into your .kode/ directory via kode init or kode install sicario. Set SICARIO_PATH to point at a pre-installed binary — useful when distributing a company-wide Sicario installation or when the binary lives outside the project tree.

Server authentication

string
Password for the Kode server. Required when running kode serve to protect the HTTP API from unauthorized access. Clients must supply this password as a credential when connecting.
string
default:"kode"
Username for the Kode server. Paired with KODE_SERVER_PASSWORD to form the basic authentication credential for the server. Defaults to kode if not set.

Usage notes

For CI/CD pipelines, always set KODE_NO_INSTALL=1 alongside your KODE_LLM_API_KEY. This ensures Kode never pauses on an interactive install prompt and fails fast if any dependency is missing from the runner image.
Environment variables take precedence over .kode/kode.json settings for API keys and endpoints. If both KODE_LLM_ENDPOINT and providers.gateway_url are set, the environment variable wins. This lets you override per-project config at the shell level without editing committed files.

Zero-config mode

If none of KODE_LLM_API_KEY, KODE_LLM_ENDPOINT, OPENAI_API_KEY, or KODE_LLM_MODEL are set, Kode enters zero-config mode and routes to the public Kode Gateway at https://api.trykode.xyz/v1 using deepseek-v4-flash. The public gateway is rate-limited to 20 requests per day per IP on the free (Lite) tier.

kode.json reference

Full reference for all fields in the project config file.

Providers

Configure AI providers, API keys, and model strings.