/reference/environment-variables
Environment variables
Complete reference for all free-claude-code configuration options. Configure providers, rate limits, timeouts, authentication, and messaging.
Environment variables
Complete reference for all free-claude-code configuration options.
Core provider variables
| Variable | Description | Default |
|---|---|---|
MODEL | Fallback model (provider/model/name format) | nvidia_nim/z-ai/glm4.7 |
MODEL_OPUS | Model for Claude Opus requests | (falls back to MODEL) |
MODEL_SONNET | Model for Claude Sonnet requests | (falls back to MODEL) |
MODEL_HAIKU | Model for Claude Haiku requests | (falls back to MODEL) |
NVIDIA_NIM_API_KEY | NVIDIA API key | required for NIM |
ENABLE_THINKING | Global switch for thinking/reasoning | true |
OPENROUTER_API_KEY | OpenRouter API key | required for OpenRouter |
DEEPSEEK_API_KEY | DeepSeek API key | required for DeepSeek |
LM_STUDIO_BASE_URL | LM Studio server URL | http://localhost:1234/v1 |
LLAMACPP_BASE_URL | llama.cpp server URL | http://localhost:8080/v1 |
Proxy and network
| Variable | Description | Default |
|---|---|---|
NVIDIA_NIM_PROXY | Proxy for NIM requests | "" |
OPENROUTER_PROXY | Proxy for OpenRouter | "" |
LMSTUDIO_PROXY | Proxy for LM Studio | "" |
LLAMACPP_PROXY | Proxy for llama.cpp | "" |
Supports http:// and socks5:// formats:
NVIDIA_NIM_PROXY="http://username:password@host:port"
NVIDIA_NIM_PROXY="socks5://host:port"
Rate limiting and timeouts
| Variable | Description | Default |
|---|---|---|
PROVIDER_RATE_LIMIT | Requests per rate window | 40 |
PROVIDER_RATE_WINDOW | Rate limit window in seconds | 60 |
PROVIDER_MAX_CONCURRENCY | Max simultaneous streams | 5 |
HTTP_READ_TIMEOUT | Read timeout in seconds | 120 |
HTTP_WRITE_TIMEOUT | Write timeout in seconds | 10 |
HTTP_CONNECT_TIMEOUT | Connect timeout in seconds | 10 |
Lower concurrency for local providers to prevent OOM:
PROVIDER_MAX_CONCURRENCY=1
Authentication
| Variable | Description | Default |
|---|---|---|
ANTHROPIC_AUTH_TOKEN | Optional API key for proxy | "" |
When set, clients must provide the same token via the ANTHROPIC_AUTH_TOKEN header. Use this when:
- Running on a public network
- Sharing the server with restricted access
- Adding a security layer
Messaging platforms
| Variable | Description | Default |
|---|---|---|
MESSAGING_PLATFORM | discord or telegram | discord |
MESSAGING_RATE_LIMIT | Messages per window | 1 |
MESSAGING_RATE_WINDOW | Messaging window (seconds) | 1 |
Discord
| Variable | Description | Default |
|---|---|---|
DISCORD_BOT_TOKEN | Discord bot token | "" |
ALLOWED_DISCORD_CHANNELS | Comma-separated channel IDs | "" |
Telegram
| Variable | Description | Default |
|---|---|---|
TELEGRAM_BOT_TOKEN | Telegram bot token | "" |
ALLOWED_TELEGRAM_USER_ID | Allowed user ID | "" |
Agent workspace
| Variable | Description | Default |
|---|---|---|
CLAUDE_WORKSPACE | Directory where agent operates | ./agent_workspace |
ALLOWED_DIR | Allowed directories for agent | "" |
CLAUDE_CLI_BIN | Claude CLI binary name | claude |
ALLOWED_DIR restricts filesystem access. When empty, the agent can access any path the user has permission to read.
Voice notes
| Variable | Description | Default |
|---|---|---|
VOICE_NOTE_ENABLED | Enable voice transcription | false |
WHISPER_DEVICE | cpu, cuda, or nvidia_nim | cpu |
WHISPER_MODEL | Model name or Hugging Face ID | base |
HF_TOKEN | Hugging Face token (optional) | "" |
Local Whisper models
For WHISPER_DEVICE="cpu" or "cuda":
tiny(fastest, least accurate)base(default)smallmediumlarge-v2large-v3large-v3-turbo(best balance)
NVIDIA NIM Whisper models
For WHISPER_DEVICE="nvidia_nim":
openai/whisper-large-v3nvidia/parakeet-ctc-1.1b-asr
Request optimization
These intercept trivial requests locally to save API quota:
| Variable | Description | Default |
|---|---|---|
FAST_PREFIX_DETECTION | Enable fast prefix detection | true |
ENABLE_NETWORK_PROBE_MOCK | Mock network probe requests | true |
ENABLE_TITLE_GENERATION_SKIP | Skip title generation | true |
ENABLE_SUGGESTION_MODE_SKIP | Skip suggestion mode | true |
ENABLE_FILEPATH_EXTRACTION_MOCK | Mock filepath extraction | true |
Disable any of these if you need the actual LLM response for these operations:
ENABLE_TITLE_GENERATION_SKIP=false
.env.example
The repository includes a complete .env.example file. Copy it as a starting point:
cp .env.example .env
Then edit only the values you need to change. All variables have sensible defaults.
Configuration priority
Configuration is loaded in this order (later overrides earlier):
- Built-in defaults
.envfile in project root- Environment variables set in shell
~/.config/free-claude-code/.env(if using package install)
Command-line environment variables take highest priority:
MODEL="nvidia_nim/moonshotai/kimi-k2.5" uv run uvicorn server:app