Download src/config.py from e2dew32/free_api: direct link, hf CLI and curl.
- Browser
- Download file 981 Bytes
-
https://huggingface.co/spaces/e2dew32/free_api/resolve/main/src/config.py
- Command line
-
hf download hf://spaces/e2dew32/free_api/src/config.py
-
curl -L -o config.py https://huggingface.co/spaces/e2dew32/free_api/resolve/main/src/config.py
981 Bytes
| import os | |
| from typing import List | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| def get_api_keys() -> List[str]: | |
| keys_str = os.getenv("OPENROUTER_API_KEYS", "") | |
| if not keys_str: | |
| raise ValueError("OPENROUTER_API_KEYS environment variable is not set") | |
| keys = [k.strip() for k in keys_str.split(",") if k.strip()] | |
| if not keys: | |
| raise ValueError("No valid API keys found in OPENROUTER_API_KEYS") | |
| return keys | |
| def get_scan_interval_hours() -> float: | |
| return float(os.getenv("SCAN_INTERVAL_HOURS", "1")) | |
| def get_max_retries() -> int: | |
| return int(os.getenv("MAX_RETRIES", "3")) | |
| def get_retry_delay() -> int: | |
| return int(os.getenv("RETRY_DELAY", "5")) | |
| def get_request_timeout() -> int: | |
| return int(os.getenv("REQUEST_TIMEOUT", "30")) | |
| def get_max_concurrency() -> int: | |
| return int(os.getenv("MAX_CONCURRENCY", "5")) | |
| def get_test_prompt() -> str: | |
| return os.getenv("TEST_PROMPT", "hi") | |