Skip to content

google-vertex-anthropic provider can't use the 1M context window for Opus 4. #14003

Closed as not planned

Description

@nhabbash

Description

The google-vertex-anthropic provider can't use the 1M context window for Opus 4.6. I had OpenCode explore a bit why, as I have Opus 4.6 [1M] working correctly with Claude Code on the same provider.
It seems to be because Vertex AI requires the beta flag as a body parameter ("anthropic_beta": ["context-1m-2025-08-07"]), not an HTTP header. Setting headers in provider config sends it as an HTTP header, which Vertex rejects with "Unexpected value(s) for the anthropic-beta header". There's no config option to inject body parameters. Confirmed via curl that the body param form works on the same endpoint.

# Note: I am on a regional endpoint
curl -X POST \
  -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
  -H "Content-Type: application/json" \
  "https://$GCLOUD_REGION-aiplatform.googleapis.com/v1/projects/$GCLOUD_PROJECT/locations/$GCLOUD_REGION/publishers/anthropic/models/claude-opus-4-6:rawPredict" \
  -d '{"anthropic_version":"vertex-2023-10-16","anthropic_beta":["context-1m-2025-08-07"],"messages":[...],"max_tokens":20}'

Claude Code seems to handle this by auto-converting the header to a body param in its Vertex SDK adapter — the @ai-sdk/google-vertex/anthropic package used by OpenCode doesn't do this.
All these issues seem to be related, just not for Vertex but for Zen/Bedrock: #12452, #12338, #13199

Plugins

No response

OpenCode version

1.1.60

Steps to reproduce

  1. Configure google-vertex-anthropic with claude-opus-4-6 and set limit.context: 1000000
  2. Add "headers": {"anthropic-beta": "context-1m-2025-08-07"} to provider options
  3. API returns 400: "Unexpected value(s) context-1m-2025-08-07 for the anthropic-beta header"
  4. Without the header, it works but caps at 200K

Screenshot and/or share link

No response

Operating System

macOS Sequoia 15.7.2

Terminal

kitty

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Feb 17, 2026
  2. inventumamet commented on Feb 22, 2026

    @inventumamet

    i'm on 1.2.10 and it's still not fixed

  3. fstanis commented on Mar 27, 2026

    @fstanis
  4. removed
    bugSomething isn't working
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  5. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions