()
| 354 | } |
| 355 | |
| 356 | getModel() { |
| 357 | const modelId = this.options.apiModelId |
| 358 | const id = modelId && modelId in anthropicModels ? (modelId as AnthropicModelId) : anthropicDefaultModelId |
| 359 | let info: ModelInfo = anthropicModels[id] |
| 360 | |
| 361 | // If 1M context beta is enabled for supported models, update the model info |
| 362 | if ( |
| 363 | (id === "claude-sonnet-4-20250514" || |
| 364 | id === "claude-sonnet-4-5" || |
| 365 | id === "claude-sonnet-4-6" || |
| 366 | id === "claude-opus-4-6") && |
| 367 | this.options.anthropicBeta1MContext |
| 368 | ) { |
| 369 | // Use the tier pricing for 1M context |
| 370 | const tier = info.tiers?.[0] |
| 371 | if (tier) { |
| 372 | info = { |
| 373 | ...info, |
| 374 | contextWindow: tier.contextWindow, |
| 375 | inputPrice: tier.inputPrice, |
| 376 | outputPrice: tier.outputPrice, |
| 377 | cacheWritesPrice: tier.cacheWritesPrice, |
| 378 | cacheReadsPrice: tier.cacheReadsPrice, |
| 379 | } |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | const params = getModelParams({ |
| 384 | format: "anthropic", |
| 385 | modelId: id, |
| 386 | model: info, |
| 387 | settings: this.options, |
| 388 | defaultTemperature: 0, |
| 389 | }) |
| 390 | |
| 391 | // The `:thinking` suffix indicates that the model is a "Hybrid" |
| 392 | // reasoning model and that reasoning is required to be enabled. |
| 393 | // The actual model ID honored by Anthropic's API does not have this |
| 394 | // suffix. |
| 395 | return { |
| 396 | id: id === "claude-3-7-sonnet-20250219:thinking" ? "claude-3-7-sonnet-20250219" : id, |
| 397 | info, |
| 398 | betas: id === "claude-3-7-sonnet-20250219:thinking" ? ["output-128k-2025-02-19"] : undefined, |
| 399 | ...params, |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | async completePrompt(prompt: string) { |
| 404 | const { id: model, temperature } = this.getModel() |
no test coverage detected