Initialize the synchronous OpenRouter client.
(self)
| 43 | self.async_client = None # Initialize async client only when needed |
| 44 | |
| 45 | def init_sync_client(self): |
| 46 | """Initialize the synchronous OpenRouter client.""" |
| 47 | from api.config import OPENROUTER_API_KEY |
| 48 | api_key = OPENROUTER_API_KEY |
| 49 | if not api_key: |
| 50 | log.warning("OPENROUTER_API_KEY not configured") |
| 51 | |
| 52 | # OpenRouter doesn't have a dedicated client library, so we'll use requests directly |
| 53 | return { |
| 54 | "api_key": api_key, |
| 55 | "base_url": "https://openrouter.ai/api/v1" |
| 56 | } |
| 57 | |
| 58 | def init_async_client(self): |
| 59 | """Initialize the asynchronous OpenRouter client.""" |