# ============================================================================== # CRouter Environment Configuration (Zero-Budget Local Defaults) # ============================================================================== # "One Gateway. Every Model." # By default, CRouter operates strictly in Rp0 Local Mock Mode with zero external # dependencies, zero token cost, and 100% deterministic latency and failure injection. # ============================================================================== # Server Configuration GATEWAY_HOST=0.0.0.0 GATEWAY_PORT=8000 DEBUG=false ENVIRONMENT=development # Database Configuration # PostgreSQL (Default for Docker Compose production/local stack): DATABASE_URL=postgresql+asyncpg://crouter:crouter_secret@localhost:5432/crouter_db # SQLite (Uncomment for zero-dependency local offline run without Docker): # DATABASE_URL=sqlite+aiosqlite:///./crouter.db # Cache & Distributed Limiter (Redis for distributed sliding-window limits) REDIS_URL=redis://localhost:6379/0 # When true, automatically falls back to safe in-memory limiting if Redis is unavailable: REDIS_FALLBACK_IN_MEMORY=true # Built-in Mock Provider Configuration (Deterministic Rp0 Mock Subservice) MOCK_PROVIDER_URL=http://localhost:8001 MOCK_PROVIDER_PORT=8001 # ============================================================================== # OPTIONAL LIVE PROVIDERS (BYOK — Bring Your Own Key) # ============================================================================== # Leave blank to stay in Rp0 Local Mode (default). # When keys are supplied, CRouter seamlessly dispatches traffic to real AI endpoints: # # 1. Google Gemini: # - Get your API key: https://aistudio.google.com/app/apikey (Free tier available) # - Models supported: gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash-exp # - Configured in alias: "fast/chat" (Priority 1) or direct model: "gemini-1.5-flash" GEMINI_API_KEY= # # 2. OpenRouter: # - Get your API key: https://openrouter.ai/keys # - Models supported: meta-llama/llama-3.2-3b-instruct:free, google/gemini-2.0-flash-exp:free, etc. # - Configured in alias: "fast/chat" (Priority 2 fallback) or "openrouter/" OPENROUTER_API_KEY= # # 3. 9Router / Command Code: # - Get your API key: https://commandcode.ai/settings # - Models supported: poolside/laguna-s-2.1-free, inclusionai/ling-3.0-flash-sante:free, etc. # - Configured in alias: "9router" or "9router/" COMMANDCODE_API_KEY= COMMANDCODE_BASE_URL=https://api.commandcode.ai/provider/v1 # # Live Smoke Testing: # To verify live keys with zero code changes, run: # python scripts/smoke_test_live.py # ============================================================================== # Default Limits & Circuit Breaker Thresholds DEFAULT_RATE_LIMIT_RPM=60 DEFAULT_MAX_CONCURRENCY=10 DEFAULT_REQUEST_TIMEOUT_MS=15000 BREAKER_FAILURE_THRESHOLD=5 BREAKER_COOLDOWN_SECONDS=30