Skip to main content
Kode supports 25+ AI providers and ships with its own gateway at api.trykode.xyz for unified, zero-friction access to the best models across OpenAI, Anthropic, DeepSeek, Google, and OpenRouter. You configure your provider once — in kode.json or via environment variables — and Kode handles routing, streaming, and key management automatically.

The Kode Gateway

The Kode Gateway is the default provider. It is a routing layer that sits in front of multiple upstream providers and exposes a single OpenAI-compatible endpoint. You authenticate with one key (KODE_LLM_API_KEY) and the gateway handles dispatch to the right upstream model. The gateway is pre-configured in every kode init output:
.kode/kode.json
To authenticate, set your API key:
The gateway routes to OpenAI, Anthropic, DeepSeek, Google, and OpenRouter based on the model you select in kode.json. You do not need individual provider keys when using the gateway.

Gateway tiers

The Lite tier is rate-limited at the gateway level. When you exceed 20 requests per day, the gateway returns a rate limit error explaining that your daily Lite quota has been reached. Set KODE_PRO_API_KEY or upgrade at trykode.xyz/pricing to remove the limit.

Using a direct provider

If you prefer to call a provider’s API directly — bypassing the Kode Gateway — set model in kode.json to the provider/model string for your chosen model and export the corresponding API key environment variable.
1

Set the model in kode.json

Edit .kode/kode.json and set the model field to the provider/model string. For example, to use Claude Sonnet 4.6 directly via Anthropic:
.kode/kode.json
2

Export the provider API key

Set the environment variable corresponding to your chosen provider:
3

Run Kode

Kode picks up the key and routes directly to the provider:

Supported model strings

Use these strings in the model and small_model fields of your kode.json:
Run kode models to see every model string available for your configured providers, including metadata such as input and output cost per million tokens.

Provider management CLI

The TypeScript CLI layer exposes providers and models subcommands for managing credentials and browsing available models. These commands are forwarded automatically from the kode binary:

Credentials

Models

Credentials stored via kode providers login are saved to ~/.kode/auth.json. Environment variables (e.g. ANTHROPIC_API_KEY) are detected automatically by kode providers list and shown alongside stored credentials. Environment variables always take precedence over stored credentials at runtime.

Pointing Kode at a local model

You can run Kode against any OpenAI-compatible local inference server — Ollama, LM Studio, llama.cpp, vLLM, and others all work. Override the endpoint and model via environment variables:
Local models vary widely in instruction-following quality. Kode’s verification pipeline (blast-radius checks, TDD gating, SAST scanning) still runs against the output, so bad patches are caught before reaching disk — but expect more retries and self-correction cycles with smaller models.

kode.json reference

Full reference for all model, engine, and permission settings.

Environment Variables

Complete list of environment variables including all provider key names.