from pydantic_settings import BaseSettings from typing import List, Optional import os class Settings(BaseSettings): # App app_env: str = "development" app_secret_key: str = "dev-secret-key" allowed_origins: str = "http://localhost:5173,http://localhost:3000" # Supabase supabase_url: str = "" supabase_anon_key: str = "" supabase_service_role_key: str = "" # Qdrant qdrant_url: str = "http://localhost:6333" qdrant_api_key: Optional[str] = None # LLM Providers openai_api_key: Optional[str] = None anthropic_api_key: Optional[str] = None google_api_key: Optional[str] = None fireworks_api_key: Optional[str] = None # Embeddings embedding_model: str = "text-embedding-3-small" # Stripe stripe_secret_key: str = "" stripe_webhook_secret: str = "" stripe_starter_price_id: str = "" stripe_pro_price_id: str = "" # Redis redis_url: str = "redis://localhost:6379" # Sentry sentry_dsn: Optional[str] = None # Files max_file_size_mb: int = 50 @property def allowed_origins_list(self) -> List[str]: return [o.strip() for o in self.allowed_origins.split(",")] class Config: env_file = ".env" case_sensitive = False settings = Settings() # ═══════════════════════════════════════════════════════════════════════════════ # MODEL CATALOG — Single source of truth for all model metadata # ═══════════════════════════════════════════════════════════════════════════════ # To add a new model: # 1. Add it here with name/provider/badge/description # 2. Add its model_id → provider mapping in MODEL_PROVIDERS # 3. Add it to the appropriate plan(s) in PLAN_LIMITS # That's it — the frontend loads everything from GET /api/v1/models/available # ═══════════════════════════════════════════════════════════════════════════════ MODEL_CATALOG = { # ── Free tier (Fireworks - lightweight) ──────────────────────────────────── "accounts/fireworks/models/kimi-k2-instruct-0905": { "name": "Kimi K2", "provider": "Fireworks AI", "badge": "Free", "description": "Free model for building and testing chatbots", }, # ── Starter tier (Fireworks - powerful) ──────────────────────────────────── "accounts/fireworks/models/llama-v3p1-70b-instruct": { "name": "Llama 3.1 70B", "provider": "Fireworks AI", "badge": "Fast", "description": "Fast open-source model, great for most tasks", }, "accounts/fireworks/models/mixtral-8x7b-instruct": { "name": "Mixtral 8x7B", "provider": "Fireworks AI", "badge": "Balanced", "description": "Balanced speed and quality", }, "accounts/fireworks/models/qwen2p5-72b-instruct": { "name": "Qwen 2.5 72B", "provider": "Fireworks AI", "badge": "Multilingual", "description": "Excellent multilingual capabilities", }, # ── Pro tier (Premium providers) ─────────────────────────────────────────── "gpt-4o": { "name": "GPT-4o", "provider": "OpenAI", "badge": "Powerful", "description": "Most capable OpenAI model", }, "gpt-4-turbo": { "name": "GPT-4 Turbo", "provider": "OpenAI", "badge": "Smart", "description": "Fast and capable with large context", }, "gpt-3.5-turbo": { "name": "GPT-3.5 Turbo", "provider": "OpenAI", "badge": "Efficient", "description": "Cost-effective for simpler tasks", }, "claude-3-5-sonnet-20241022": { "name": "Claude 3.5 Sonnet", "provider": "Anthropic", "badge": "Reasoning", "description": "Excellent at analysis and reasoning", }, "claude-3-opus-20240229": { "name": "Claude 3 Opus", "provider": "Anthropic", "badge": "Advanced", "description": "Most capable Anthropic model", }, "gemini-1.5-pro": { "name": "Gemini 1.5 Pro", "provider": "Google", "badge": "Long Context", "description": "Handles very long documents well", }, } # ─── Model ID → LLM provider mapping (used by llm_client.py for routing) ───── MODEL_PROVIDERS = { "accounts/fireworks/models/kimi-k2-instruct-0905": "fireworks", "accounts/fireworks/models/llama-v3p1-70b-instruct": "fireworks", "accounts/fireworks/models/mixtral-8x7b-instruct": "fireworks", "accounts/fireworks/models/qwen2p5-72b-instruct": "fireworks", "gpt-4o": "openai", "gpt-4-turbo": "openai", "gpt-3.5-turbo": "openai", "claude-3-5-sonnet-20241022": "anthropic", "claude-3-opus-20240229": "anthropic", "gemini-1.5-pro": "google", } # ─── Default model per plan (pre-selected in the frontend) ──────────────────── DEFAULT_MODELS = { "free": "accounts/fireworks/models/kimi-k2-instruct-0905", "starter": "accounts/fireworks/models/llama-v3p1-70b-instruct", "pro": "gpt-4o", "enterprise": "gpt-4o", } # ─── Plan limits ────────────────────────────────────────────────────────────── PLAN_LIMITS = { "free": { "max_chatbots": 999999, # unlimited creation "max_published": 0, # cannot publish "models": [ "accounts/fireworks/models/kimi-k2-instruct-0905", ], "conversations_limit": 999999, # unlimited preview "code_export": False, "features": ["preview_mode", "testing"], }, "starter": { "max_chatbots": 999999, "max_published": 1, "models": [ "accounts/fireworks/models/kimi-k2-instruct-0905", "accounts/fireworks/models/llama-v3p1-70b-instruct", "accounts/fireworks/models/mixtral-8x7b-instruct", "accounts/fireworks/models/qwen2p5-72b-instruct", ], "conversations_limit": 5000, "code_export": False, "features": ["marketplace", "analytics", "branding"], }, "pro": { "max_chatbots": 3, "max_published": 3, "models": [ "accounts/fireworks/models/kimi-k2-instruct-0905", "accounts/fireworks/models/llama-v3p1-70b-instruct", "accounts/fireworks/models/mixtral-8x7b-instruct", "gpt-4o", "gpt-4-turbo", "gpt-3.5-turbo", "claude-3-5-sonnet-20241022", "claude-3-opus-20240229", "gemini-1.5-pro", ], "conversations_limit": 20000, "code_export": True, "features": [ "marketplace", "code_export", "advanced_analytics", "priority_support", "custom_domain", "ab_testing", ], }, "enterprise": { "max_chatbots": 999999, "max_published": 999999, "models": ["*"], # resolves to all MODEL_CATALOG keys "conversations_limit": 999999, "code_export": True, "features": ["*"], }, }