Skip to main content

Configuration

All configuration is loaded from environment variables through app/core/config.py using Pydantic BaseSettings. Copy .env.example to .env and fill in your values before running.

Core

| Variable | Required | Default | Description | |---|---|---|---| | SECRET_KEY | Yes | — | 32-byte hex string for JWT signing. Generate: openssl rand -hex 32 | | ENVIRONMENT | No | development | development or production | | DEBUG | No | false | Enables debug logging and stack traces | | ALLOWED_ORIGINS | No | * | Comma-separated CORS origins |

Database

| Variable | Required | Default | Description | |---|---|---|---| | DATABASE_URL | Yes | — | PostgreSQL async URL: postgresql+asyncpg://user:pass@host:5432/db | | DB_POOL_SIZE | No | 10 | SQLAlchemy connection pool size | | DB_MAX_OVERFLOW | No | 20 | Pool overflow allowance |

Redis

| Variable | Required | Default | Description | |---|---|---|---| | REDIS_URL | Yes | — | redis://host:6379/0 |

LLM Providers

At least one LLM provider key is required.

| Variable | Required | Description | |---|---|---| | OPENAI_API_KEY | Conditional | OpenAI API key. Set LLM_PROVIDER=openai. | | ANTHROPIC_API_KEY | Conditional | Anthropic API key. Set LLM_PROVIDER=anthropic. | | LLM_PROVIDER | No (default: openai) | Active provider: openai, anthropic, or openai_compatible. | | LLM_BASE_URL | No | Override base URL for openai_compatible provider (e.g., Ollama) | | LLM_DEFAULT_MODEL | No | Default model name (e.g., gpt-4o, claude-3-5-sonnet-20241022) |

Vector Store (RAG)

| Variable | Required | Description | |---|---|---| | VECTOR_STORE | No (default: pgvector) | pgvector or qdrant | | QDRANT_URL | Conditional | Required when VECTOR_STORE=qdrant | | QDRANT_API_KEY | Conditional | Qdrant Cloud API key | | EMBEDDING_MODEL | No (default: text-embedding-3-small) | OpenAI embedding model |

Billing

| Variable | Required | Description | |---|---|---| | STRIPE_SECRET_KEY | No | Stripe secret key for usage metering webhooks | | STRIPE_WEBHOOK_SECRET | No | Webhook signing secret | | BILLING_ENABLED | No (default: false) | Toggle billing metering on/off |

Rate Limiting

Rate limits are defined per API key tier in app/core/config.py:

RATE_LIMITS = {
    "free":       {"per_minute": 10,  "per_day": 100},
    "starter":    {"per_minute": 60,  "per_day": 5_000},
    "pro":        {"per_minute": 300, "per_day": 50_000},
    "enterprise": {"per_minute": -1,  "per_day": -1},  # unlimited
}

Edit this dict to change limits without touching route code.