(options: ApiHandlerOptions)
| 147 | private currentReasoningDetails: any[] = [] |
| 148 | |
| 149 | constructor(options: ApiHandlerOptions) { |
| 150 | super() |
| 151 | this.options = options |
| 152 | |
| 153 | const baseURL = this.options.openRouterBaseUrl || "https://openrouter.ai/api/v1" |
| 154 | const apiKey = this.options.openRouterApiKey ?? "not-provided" |
| 155 | |
| 156 | this.client = new OpenAI({ baseURL, apiKey, defaultHeaders: DEFAULT_HEADERS, timeout: this.timeoutMs }) |
| 157 | |
| 158 | // Load models asynchronously to populate cache before getModel() is called |
| 159 | this.loadDynamicModels().catch((error) => { |
| 160 | console.error("[OpenRouterHandler] Failed to load dynamic models:", error) |
| 161 | }) |
| 162 | } |
| 163 | |
| 164 | private async loadDynamicModels(): Promise<void> { |
| 165 | try { |
nothing calls this directly
no test coverage detected