diff --git a/pyproject.toml b/pyproject.toml index 013b77b..84bd72a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ dependencies = [ "sqlalchemy", "httpx", "aiosqlite", + "openai", ] [project.optional-dependencies] diff --git a/src/moai/bot/config.py b/src/moai/bot/config.py index bbcf556..77da880 100644 --- a/src/moai/bot/config.py +++ b/src/moai/bot/config.py @@ -17,12 +17,18 @@ class BotConfig: allowed_users: Set of allowed Telegram user IDs. Empty means all users allowed. database_url: SQLAlchemy database URL. log_level: Logging level string (DEBUG, INFO, WARNING, ERROR). + ai_router: AI router service ("requesty" or "openrouter"). + ai_api_key: API key for the AI router service. + ai_referer: HTTP-Referer header for OpenRouter (optional). """ bot_token: str allowed_users: set[int] database_url: str log_level: str + ai_router: str + ai_api_key: str + ai_referer: str | None @classmethod def from_env(cls) -> "BotConfig": @@ -33,6 +39,9 @@ class BotConfig: ALLOWED_USERS (optional): Comma-separated Telegram user IDs. DATABASE_URL (optional): Database URL, defaults to SQLite. LOG_LEVEL (optional): Logging level, defaults to INFO. + AI_ROUTER (optional): AI router service, defaults to "requesty". + AI_API_KEY (optional): API key for the AI router service. + AI_REFERER (optional): HTTP-Referer header for OpenRouter. Returns: BotConfig instance populated from environment. @@ -56,9 +65,17 @@ class BotConfig: database_url = os.environ.get("DATABASE_URL", "sqlite+aiosqlite:///./moai.db") log_level = os.environ.get("LOG_LEVEL", "INFO") + # AI router configuration + ai_router = os.environ.get("AI_ROUTER", "requesty") + ai_api_key = os.environ.get("AI_API_KEY", "") + ai_referer = os.environ.get("AI_REFERER") + return cls( bot_token=bot_token, allowed_users=allowed_users, database_url=database_url, log_level=log_level, + ai_router=ai_router, + ai_api_key=ai_api_key, + ai_referer=ai_referer, )