from __future__ import annotations from functools import lru_cache from typing import Optional from pydantic_settings import BaseSettings, SettingsConfigDict class Settings(BaseSettings): model_config = SettingsConfigDict( env_file=".env", env_file_encoding="utf-8", extra="ignore", ) app_name: str = "All API Collection" app_version: str = "1.0.0" environment: str = "production" host: str = "0.0.0.0" port: int = 7860 workers: int = 1 log_level: str = "INFO" enable_colors: bool = True api_key: str = "changeme" max_upload_bytes: int = 15 * 1024 * 1024 max_batch_files: int = 10 max_batch_urls: int = 20 ocr_det_cuda: bool = False ocr_det_dml: bool = False ocr_cls_cuda: bool = False ocr_cls_dml: bool = False ocr_rec_cuda: bool = False ocr_rec_dml: bool = False self_ping_url: str = "https://aetherbase-llm-ready-data.hf.space/ping" spacy_model: str = "en_core_web_sm" code_exec_max_time: int = 10 code_exec_max_memory: int = 128 code_exec_max_output: int = 65536 code_exec_max_concurrent: int = 16 code_exec_workdir: str = "/tmp/code-runner" searxng_base_url: str = "http://localhost:8888" searxng_timeout: int = 30 searxng_max_retries: int = 2 searxng_max_results: int = 20 scrape_default_fetcher: str = "http" scrape_default_proxy: Optional[str] = None scrape_network_idle: bool = False redis_url: Optional[str] = None openrouter_mimika_api_key: Optional[str] = None aion_lab_keys: str = "" ai_api_keys: str = "" proxy_auth_key: str = "changeme" request_timeout_ms: int = 60000 key_lock_ttl: int = 600 rounds_per_model: int = 50 data_dir: str = "./data" embedding_model: str = "ibm-granite/granite-embedding-small-english-r2" embedding_dimension: int = 384 default_top_k: int = 10 max_chunk_size: int = 512 chunk_overlap: int = 64 jwt_secret_key: str = "changeme-jwt-secret" jwt_algorithm: str = "HS256" jwt_default_expiry_minutes: int = 30 jwt_issuer: str = "all-api-collection" database_url: str = "sqlite+aiosqlite:///data/auth.db" access_token_expire_minutes: int = 15 refresh_token_expire_days: int = 7 max_login_attempts: int = 5 lockout_minutes: int = 15 application_id: str = "" admin_password: str = "" @property def max_upload_mb(self) -> int: return self.max_upload_bytes // (1024 * 1024) MODELS = [ "mistralai/Mistral-Small-3.2-24B-Instruct-2506", "meganova-ai/manta-flash-1.0", "meganova-ai/manta-mini-1.0", "FallenMerick/MN-Violet-Lotus-12B", "Sao10K/L3-70B-Euryale-v2.1", "Sao10K/L3-8B-Stheno-v3.2", ] MEGANOVA_BASE_URL = "https://api.meganova.ai" MEGANOVA_CHAT_PATH = "/v1/chat/completions" OPENROUTER_MIMIKA_BASE_URL = "https://openprovider.mimika.in" OPENROUTER_MIMIKA_CHAT_PATH = "/v1/chat/completions" OPENROUTER_MIMIKA_MODEL = "openprovider/auto-free" AION_LABS_BASE_URL = "https://api.aionlabs.ai" AION_LABS_CHAT_PATH = "/v1/chat/completions" AION_LABS_DEFAULT_MODEL = "aion-labs/aion-2.5" DEFAULT_MAX_TOKENS = 1024 DEFAULT_TEMPERATURE = 0.7 DEFAULT_TOP_P = 0.9 DEFAULT_STREAM = False @lru_cache(maxsize=1) def get_settings() -> Settings: return Settings()