Configuration

All settings are environment variables. Start from `.env.example` and keep keys server-side.

Providers
Enable providers by setting API keys.
OPENAI_API_KEY=...
ANTHROPIC_API_KEY=...
OPENROUTER_API_KEY=...
GROQ_API_KEY=...
TOGETHER_API_KEY=...
FIREWORKS_API_KEY=...
XAI_API_KEY=...
MISTRAL_API_KEY=...
Optional per-provider headers:
PROVIDER_EXTRA_HEADERS_JSON={"openrouter":{"HTTP-Referer":"https://example.com"}}
Routing
Profiles are comma-separated provider:model lists.
ROUTE_ECO_FAST=openai:gpt-5-mini,anthropic:claude-haiku-4-5,openrouter:google/gemini-2.5-flash
ROUTE_PREMIUM_REASONING=openai:gpt-5,anthropic:claude-sonnet-4-6,openrouter:openai/gpt-5.1
Controls & limits
Caps prevent oversized requests and runaway outputs.
REQUEST_MAX_BODY_BYTES=50000
REQUEST_MAX_CHARS=12000
MESSAGE_MAX_CHARS=4000
CONTEXT_MAX_MESSAGES=20
ECO_DEFAULT_MAX_OUTPUT_TOKENS=256
DEFAULT_MAX_OUTPUT_TOKENS=512
DEFAULT_TEMPERATURE=0.2
ALLOW_CUSTOM_MODEL_ID=false
Security & auth
Lock down mutating API requests and require workspace keys.
REQUIRE_AUTH=true
WORKSPACE_API_KEYS_JSON={"acme":"sk_live_..."}
ALLOWED_ORIGINS=https://app.example.com,https://dashboard.example.com
Storage & cache
Postgres stores receipts and conversations. Redis powers rate limits.
DATABASE_URL=postgres://...
REDIS_URL=redis://...
CACHE_TTL_SECONDS=3600
RATE_LIMIT_PER_MIN=30
Emissions & baseline
Factors are estimates per 1k tokens.
EMISSIONS_FACTOR_DEFAULT_KGCO2E_PER_1K_TOKENS=0.0005
EMISSIONS_FACTORS_JSON={"openai":{"default":0.0006}}
BASELINE_ENABLED=true
BASELINE_LABEL=default-llm
BASELINE_FACTOR_KGCO2E_PER_1K_TOKENS=0.0009
SEO & verification
Optional tokens for Google, Bing, and Yandex webmaster verification.
GOOGLE_SITE_VERIFICATION=...
BING_SITE_VERIFICATION=...
YANDEX_SITE_VERIFICATION=...
Agent-readable index is available at /llms.txt.