Repository navigation
[BUG]: AI SDK v6 sends unsupported structured-outputs-2025-11-13 anthropic-beta header, breaking Vertex AI #19700
Description
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-betaheader 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 OKRoot 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/anthropicas provider will start passing a new anthropic beta valuestructured-outputs-2025-11-13inside theanthropic-betaheader. 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:
- Vertex: Unexpected value(s)
structured-outputs-2025-11-13for theanthropic-betaheader vercel/ai#10981 — "Vertex: Unexpected value(s)structured-outputs-2025-11-13for theanthropic-betaheader" (closed) - fix(vertex/anthropic): passing beta header only for structured outputs vercel/ai#11015 — fix for
@ai-sdk/google-vertex/anthropic(only pass header when using structured outputs) - fix(anthropic/provider): Do not use structured output header with json response tool vercel/ai#11851 — fix for
@ai-sdk/anthropicwith json response tool
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)
Activity
[-]bug: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI and proxy providers[/-][+][bug]: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI and proxy providers[/+][-][bug]: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI and proxy providers[/-][+]bug: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI[/+][-]bug: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI[/-][+][BUG]: AI SDK v6 sends unsupported `structured-outputs-2025-11-13` anthropic-beta header, breaking Vertex AI[/+]cc-bjojac commentedon Apr 8, 2026
I don't think this is fixed. I'm using opencode 1.4.0, vertex.ai, sonnet 4.6 and still see the very same error.
minimAluminiumalism commentedon Apr 8, 2026
Maybe you should use
@ai-sdk/googlein opencode config rather than@ai-sdk/anthropic. I think it's just a configuration issue.enolive commentedon Apr 8, 2026
sorry for my confusion, but I can't get the
@ai-sdk/anthropicprovider to work in versions higher than 1.3.3 for opencode.I am currently working with an AI Gateway. Prior to 1.3.4, the setup worked correctly, now I get the mentioned error message
using
@ai-sdk/googleor@ai-sdk/google-vertexintroduces other curious bugs (such as a missing x-portkey-provider header).here is the relevant part of my config:
should I open a separate issue?