()
| 550 | } |
| 551 | |
| 552 | override getModel() { |
| 553 | const id = this.options.openRouterModelId ?? openRouterDefaultModelId |
| 554 | let info = this.models[id] ?? openRouterDefaultModelInfo |
| 555 | |
| 556 | // If a specific provider is requested, use the endpoint for that provider. |
| 557 | if (this.options.openRouterSpecificProvider && this.endpoints[this.options.openRouterSpecificProvider]) { |
| 558 | info = this.endpoints[this.options.openRouterSpecificProvider] |
| 559 | } |
| 560 | |
| 561 | // Apply tool preferences for models accessed through routers (OpenAI, Gemini) |
| 562 | info = applyRouterToolPreferences(id, info) |
| 563 | |
| 564 | const isDeepSeekR1 = id.startsWith("deepseek/deepseek-r1") || id === "perplexity/sonar-reasoning" |
| 565 | |
| 566 | const params = getModelParams({ |
| 567 | format: "openrouter", |
| 568 | modelId: id, |
| 569 | model: info, |
| 570 | settings: this.options, |
| 571 | defaultTemperature: isDeepSeekR1 ? DEEP_SEEK_DEFAULT_TEMPERATURE : 0, |
| 572 | }) |
| 573 | |
| 574 | return { id, info, topP: isDeepSeekR1 ? 0.95 : undefined, ...params } |
| 575 | } |
| 576 | |
| 577 | async completePrompt(prompt: string) { |
| 578 | const { id: modelId, maxTokens, temperature, reasoning } = await this.fetchModel() |
no test coverage detected