Description
After upgrading to opencode v1.3.4/v1.3.5, all requests to Anthropic Claude models via Vertex AI fail with HTTP 400:
Unexpected value(s) `structured-outputs-2025-11-13` for the `anthropic-beta` header.
Please consult our documentation at docs.anthropic.com or try again without the header.
This is a regression introduced by #18433 (AI SDK v6 support), which upgraded @ai-sdk/anthropic from 2.0.65 to 3.0.64. The new SDK version injects structured-outputs-2025-11-13 into the anthropic-beta header — even for simple streamText / chat requests that do not use structured outputs.
Affected versions
- Works: opencode v1.3.3 (
@ai-sdk/anthropic@2.0.65)
- Broken: opencode v1.3.4 / v1.3.5 (
@ai-sdk/anthropic@3.0.64)
Affected providers
- google-vertex-anthropic — Vertex AI does not support this beta value
- Potentially any Anthropic-compatible endpoint that validates
anthropic-beta header values
Reproduction
- Install opencode v1.3.5:
npm install -g opencode-ai@1.3.5
- Configure any Anthropic Claude model (e.g.
claude-opus-4-6) via Vertex AI
- Send any message
Direct curl verification against Vertex AI:
# FAILS — with structured-outputs header
curl -s "https://us-east5-aiplatform.googleapis.com/v1/projects/PROJECT/locations/us-east5/publishers/anthropic/models/claude-opus-4-6:rawPredict" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Anthropic-Beta: fine-grained-tool-streaming-2025-05-14,structured-outputs-2025-11-13" \
-d '{"anthropic_version":"vertex-2023-10-16","max_tokens":32,"messages":[{"role":"user","content":"say hi"}]}'
# → 400: Unexpected value(s) `structured-outputs-2025-11-13`
# WORKS — without structured-outputs header
curl -s "https://us-east5-aiplatform.googleapis.com/v1/projects/PROJECT/locations/us-east5/publishers/anthropic/models/claude-opus-4-6:rawPredict" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-H "Anthropic-Beta: fine-grained-tool-streaming-2025-05-14" \
-d '{"anthropic_version":"vertex-2023-10-16","max_tokens":32,"messages":[{"role":"user","content":"say hi"}]}'
# → 200 OK
Root cause
@ai-sdk/anthropic@3.0.64 adds structured-outputs-2025-11-13 to the anthropic-beta header via betas.add(...) even when structured outputs are not being used. This was flagged during the review of #18433:
"with this change, models that use @ai-sdk/anthropic as provider will start passing a new anthropic beta value structured-outputs-2025-11-13 inside the anthropic-beta header. This is a breaking change (currently opencode does NOT send this value) and may cause providers that don't support this to return an error." — @avarayr in #18433
Prior art in vercel/ai
This exact issue was reported and partially fixed upstream:
However, the fix in @ai-sdk/anthropic is incomplete — the header is still sent for regular requests when tools with strict schemas are involved, and opencode's anthropic custom loader in provider.ts does not strip it.
Suggested fix
In the anthropic custom loader (packages/opencode/src/provider/provider.ts, line 157), override the fetch to strip structured-outputs-2025-11-13 from the anthropic-beta header before sending to the upstream provider. This is similar to how the codex plugin overrides fetch for its needs.
Alternatively, the header could be filtered in the options.headers merge logic within getSDK().
Environment
- opencode: v1.3.5
- OS: macOS (darwin arm64)
- Node: v24.13.1
- Bun: 1.3.11 (bundled)
Description
After upgrading to opencode v1.3.4/v1.3.5, all requests to Anthropic Claude models via Vertex AI fail with HTTP 400:
This is a regression introduced by #18433 (AI SDK v6 support), which upgraded
@ai-sdk/anthropicfrom2.0.65to3.0.64. The new SDK version injectsstructured-outputs-2025-11-13into theanthropic-betaheader — even for simplestreamText/ chat requests that do not use structured outputs.Affected versions
@ai-sdk/anthropic@2.0.65)@ai-sdk/anthropic@3.0.64)Affected providers
anthropic-betaheader valuesReproduction
npm install -g opencode-ai@1.3.5claude-opus-4-6) via Vertex AIDirect curl verification against Vertex AI:
Root cause
@ai-sdk/anthropic@3.0.64addsstructured-outputs-2025-11-13to theanthropic-betaheader viabetas.add(...)even when structured outputs are not being used. This was flagged during the review of #18433:Prior art in vercel/ai
This exact issue was reported and partially fixed upstream:
structured-outputs-2025-11-13for theanthropic-betaheader vercel/ai#10981 — "Vertex: Unexpected value(s)structured-outputs-2025-11-13for theanthropic-betaheader" (closed)@ai-sdk/google-vertex/anthropic(only pass header when using structured outputs)@ai-sdk/anthropicwith json response toolHowever, the fix in
@ai-sdk/anthropicis incomplete — the header is still sent for regular requests when tools with strict schemas are involved, and opencode's anthropic custom loader inprovider.tsdoes not strip it.Suggested fix
In the
anthropiccustom loader (packages/opencode/src/provider/provider.ts, line 157), override the fetch to stripstructured-outputs-2025-11-13from theanthropic-betaheader before sending to the upstream provider. This is similar to how the codex plugin overrides fetch for its needs.Alternatively, the header could be filtered in the
options.headersmerge logic withingetSDK().Environment