[PR #10442] fix(provider): enable thinking for google-vertex-anthropic models #13441

Closed
opened 2026-02-16 18:18:18 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10442

State: closed
Merged: Yes


Fixes reasoning/thinking not working for Claude models on GCP Vertex AI by correcting the npm package identifier and provider options key mapping.

Fixes https://github.com/anomalyco/opencode/issues/9894

What does this PR do?

Fixes reasoning/thinking not working for Claude models when using GCP Vertex AI.

I noticed that even when setting reasoning to "high" or "max", the responses were instant and showed no thinking content. After digging into the code, I found two issues:
Issue 1: The models.dev API returns npm: "@ai-sdk/google-vertex" for the google-vertex-anthropic provider, but the variant generation logic expects the subpath import "@ai-sdk/google-vertex/anthropic". Without the correct npm identifier, no thinking variants were being generated.
Issue 2: Even after fixing the npm package, the sdkKey() function didn't have a mapping for "@ai-sdk/google-vertex/anthropic", so thinking options were being wrapped with the wrong provider key ("google-vertex-anthropic" instead of "anthropic"). The AI SDK didn't recognize this and just ignored the thinking config.

Changes:

  • Added special handling in fromModelsDevModel() to transform the npm package to "@ai-sdk/google-vertex/anthropic" for google-vertex-anthropic models
  • Updated sdkKey() to map "@ai-sdk/google-vertex/anthropic""anthropic"
  • Added tests that would have caught these issues (the new unit test specifically verifies the npm package transformation from models.dev data)

How did you verify your code works?

Tested locally by running bun dev and confirming that Claude Opus 4.5 on Vertex AI now properly shows thinking when using the "high" or "max" variants. It works properly now :)

Also added unit tests that verify:

  • The npm package transformation happens correctly
  • Thinking variants are generated with proper budgetTokens
  • Provider options are wrapped with the correct "anthropic" key
**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10442 **State:** closed **Merged:** Yes --- Fixes reasoning/thinking not working for Claude models on GCP Vertex AI by correcting the npm package identifier and provider options key mapping. Fixes https://github.com/anomalyco/opencode/issues/9894 ### What does this PR do? Fixes reasoning/thinking not working for Claude models when using GCP Vertex AI. I noticed that even when setting reasoning to "high" or "max", the responses were instant and showed no thinking content. After digging into the code, I found two issues: **Issue 1:** The models.dev API returns `npm: "@ai-sdk/google-vertex"` for the google-vertex-anthropic provider, but the variant generation logic expects the subpath import `"@ai-sdk/google-vertex/anthropic"`. Without the correct npm identifier, no thinking variants were being generated. **Issue 2:** Even after fixing the npm package, the `sdkKey()` function didn't have a mapping for `"@ai-sdk/google-vertex/anthropic"`, so thinking options were being wrapped with the wrong provider key (`"google-vertex-anthropic"` instead of `"anthropic"`). The AI SDK didn't recognize this and just ignored the thinking config. Changes: - Added special handling in `fromModelsDevModel()` to transform the npm package to `"@ai-sdk/google-vertex/anthropic"` for google-vertex-anthropic models - Updated `sdkKey()` to map `"@ai-sdk/google-vertex/anthropic"` → `"anthropic"` - Added tests that would have caught these issues (the new unit test specifically verifies the npm package transformation from models.dev data) ### How did you verify your code works? Tested locally by running `bun dev` and confirming that Claude Opus 4.5 on Vertex AI now properly shows thinking when using the "high" or "max" variants. It works properly now :) Also added unit tests that verify: - The npm package transformation happens correctly - Thinking variants are generated with proper `budgetTokens` - Provider options are wrapped with the correct `"anthropic"` key
yindo added the pull-request label 2026-02-16 18:18:18 -05:00
yindo closed this issue 2026-02-16 18:18:18 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13441