"""Configuration settings for the ad generator.""" from pydantic_settings import BaseSettings, SettingsConfigDict from typing import Optional class Settings(BaseSettings): """Application settings loaded from environment variables.""" model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", case_sensitive=False, extra="ignore", ) # OpenAI API Key (required for copy generation) openai_api_key: str # Replicate API Token (required for image generation) replicate_api_token: str # Database (MongoDB) mongodb_url: Optional[str] = None mongodb_db_name: str = "psyadgenesis" # R2 Storage (Cloudflare R2) r2_endpoint: Optional[str] = None r2_bucket_name: Optional[str] = None r2_access_key: Optional[str] = None r2_secret_key: Optional[str] = None r2_public_domain: Optional[str] = None # Optional: Custom domain for public URLs (e.g., "cdn.example.com") # LLM Settings llm_model: str = "gpt-4o-mini" # Cost-effective model llm_temperature: float = 0.95 # High for variety use_ai_generated_hooks: bool = False # Set True to generate framework hook examples with AI; False = use static from frameworks.py # Vision API Settings vision_model: str = "gpt-4o" # Vision-capable model for image analysis # Third Flow (Extensive) GPT Model Settings third_flow_model: str = "gpt-4o" # Model for researcher, creative_director, designer, copywriter # Options: "gpt-4o", "gpt-4o-mini", "gpt-4-turbo", "gpt-4" # Image Generation Settings image_model: str = "z-image-turbo" # Z-Image Turbo - fast and high quality # Alternative models: "nano-banana", "nano-banana-pro", "imagen-4-ultra", "recraft-v3", "ideogram-v3", "photon", "seedream-3", "gpt-image-1.5" image_width: int = 1024 image_height: int = 1024 # Output Settings output_dir: str = "assets/generated" # Production & Storage Settings environment: str = "development" # "development" or "production" save_images_locally: bool = True # Whether to save images locally local_image_retention_hours: int = 24 # Hours to keep images locally before cleanup (only in production) # Auth Settings jwt_secret_key: str = "your-secret-key-change-in-production" # Change this in production! jwt_algorithm: str = "HS256" jwt_expiration_hours: int = 24 # Debug debug: bool = False # Global settings instance settings = Settings()