Skip to content

Environment Variables

Kolega Code reads configuration from environment variables and from a project-local .env file. This page lists everything it understands.

For any given setting, the first available source wins:

  1. CLI flags (e.g. --provider, --model)
  2. Shell environment variables
  3. Project .env file (in the project directory)
  4. Saved Settings (settings.json)

Kolega Code requires an explicit provider/model selection from flags, environment variables, a project .env file, or saved settings. API key variables alone are not a model selection source.

Set the variable for each provider you use. Only the providers backing your active model roles are required.

API key variables provide credentials only. They do not select the active provider or model.

VariableProvider
ANTHROPIC_API_KEYAnthropic
OPENAI_API_KEYOpenAI
GOOGLE_API_KEYGoogle
GROQ_API_KEYGroq
TOGETHER_API_KEYTogether.ai
FIREWORKS_API_KEYFireworks.ai
XAI_API_KEYx.ai
DASHSCOPE_API_KEYDashScope (Alibaba)
MOONSHOT_API_KEYMoonshot
DEEPSEEK_API_KEYDeepSeek
ZAI_API_KEYZ.AI (GLM Coding Plan)
KIMI_CODING_API_KEYKimi Coding Plan

The local llama provider needs no key. The zai key authenticates against Z.AI’s Anthropic-compatible endpoint (it is the key Z.AI also documents as ANTHROPIC_AUTH_TOKEN). The kimi_coding key authenticates against the Kimi Coding Plan’s separate Anthropic-compatible endpoint (https://api.kimi.com/coding/), which is distinct from the standard Moonshot API used by the moonshot provider.

Each role can be configured independently. Set just the provider to use that provider’s default model, or set both provider and model.

VariableRole
KOLEGA_CODE_PROVIDER / KOLEGA_CODE_MODELMain (long-context) coding model
KOLEGA_CODE_FAST_PROVIDER / KOLEGA_CODE_FAST_MODELFast utility model
KOLEGA_CODE_THINKING_PROVIDER / KOLEGA_CODE_THINKING_MODELThinking model
KOLEGA_CODE_THINKING_EFFORTModel-specific thinking effort

See Providers & Models for what each role does.

VariablePurpose
KOLEGA_CODE_STATE_DIROverride where settings and sessions are stored
KOLEGA_CODE_ENVIRONMENTEnvironment label attached to tracing/metadata (default development)

Optional Langfuse tracing of LLM usage.

VariablePurpose
LANGFUSE_HOSTLangfuse host URL
LANGFUSE_PUBLIC_KEYLangfuse public key
LANGFUSE_SECRET_KEYLangfuse secret key

Kolega Code automatically loads a .env file from the project directory. A good starting point:

.env
# Pick one provider's key (or several)
MOONSHOT_API_KEY=
DEEPSEEK_API_KEY=
ANTHROPIC_API_KEY=
# Optional: choose models per role
KOLEGA_CODE_PROVIDER=moonshot
KOLEGA_CODE_MODEL=kimi-k2.7-code
KOLEGA_CODE_THINKING_EFFORT=auto
# Optional: Langfuse tracing
LANGFUSE_HOST=https://us.cloud.langfuse.com
LANGFUSE_PUBLIC_KEY=
LANGFUSE_SECRET_KEY=