[BUG] claude code is setting anthropic-beta header on requests to vertexai count-tokens
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
claude code sends the anthropic-beta header with beta values to vertex's count-tokens "model" which fails with an invalid request error
This was sorta fixed but is now broken again as the web-search-2025-03-05 value started being added in 2.0.31
This never works with sonnet[1m]
What Should Happen?
when doing a count-tokens call, don't send anthropic-beta header at all as it doesn't seem to like any values there
Error Messages/Logs
{"type":"error","error":{"type":"invalid_request_error","message":"Unexpected value(s) `context-1m-2025-08-07`, `web-search-2025-03-05` for the `anthropic-beta` header. Please consult our documentation at docs.anthropic.com or try again without the header."},"request_id":"req_vrtx_011CUsThdzFzwi3LL7cCKtcw"}
Steps to Reproduce
- run claude configured against a vertex endpoint with debug logging
- see that anthropic-beta header with some values are sent to count-tokens, which fails
Claude Model
Not sure / Multiple models
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.0.30
Claude Code Version
2.0.35
Platform
Google Vertex AI
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
No response
Same here, any update on this?
same issue with me, any update?
the same, just now hit the wall
any update to this?still getting this
This should be fixed for Web Search in the next release - we're still working on the fix for Sonnet 1m
still doesn't seem to be working
Same here, error message still occurs on version 2.1.2.