Skip to content

[BUG]: AI SDK v6 sends unsupported structured-outputs-2025-11-13 anthropic-beta header, breaking Vertex AI #19700

Closed

Description

@minimAluminiumalism

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

  1. Install opencode v1.3.5: npm install -g opencode-ai@1.3.5
  2. Configure any Anthropic Claude model (e.g. claude-opus-4-6) via Vertex AI
  3. 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)

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 29, 2026
  2. changed the title [-]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[/+] on Mar 29, 2026
  3. changed the title [-][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[/+] on Mar 29, 2026
  4. changed the title [-]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[/+] on Mar 29, 2026
  5. cc-bjojac commented on Apr 8, 2026

    @cc-bjojac
    Contributor

    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.

  6. minimAluminiumalism commented on Apr 8, 2026

    @minimAluminiumalism
    Author

    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.

    Maybe you should use @ai-sdk/google in opencode config rather than @ai-sdk/anthropic. I think it's just a configuration issue.

  7. enolive commented on Apr 8, 2026

    @enolive

    sorry for my confusion, but I can't get the @ai-sdk/anthropic provider 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/google or @ai-sdk/google-vertex introduces other curious bugs (such as a missing x-portkey-provider header).

    here is the relevant part of my config:

    "provider": {
            // Alternative provider using Anthropic SDK for proper Claude metadata
            "portkey-anthropic": {
                "npm": "@ai-sdk/anthropic",
                "name": "Portkey Anthropic pretender",
                "options": {
                    "baseURL": "https://api.portkey.ai/v1",
                    "apiKey": "dummy",
                    "headers": {
                        "x-portkey-api-key": "{env:PORTKEY_API_KEY}"
                    }
                },
                "models": {
                    "@vertex-ai/anthropic.claude-sonnet-4-6": {

    should I open a separate issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions