Skip to content

Conversation

@pavelkraleu
Copy link

Add ability to filter specific values from the anthropic-beta header for VertexAI Anthropic models. This addresses compatibility issues where VertexAI rejects certain beta header values that Anthropic's API accepts.

Usage in YAML config:

model_list:
  - model_name: vertex-claude-sonnet
    litellm_params:
      model: vertex_ai/claude-sonnet-4@20250514
      exclude_anthropic_beta_values:
        - "context-1m-2025-08-07"

Changes:

  • Add exclude_anthropic_beta_values field to GenericLiteLLMParams
  • Filter beta values in VertexAIAnthropicConfig.transform_request()
  • Filter beta headers in VertexAIPartnerModelsAnthropicMessagesConfig
  • Add unit tests for both handlers

🤖 Generated with Claude Code

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

@vercel
Copy link

vercel bot commented Dec 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Dec 17, 2025 2:06pm

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Add ability to filter specific values from the anthropic-beta header
for VertexAI Anthropic models. This addresses compatibility issues where
VertexAI rejects certain beta header values that Anthropic's API accepts.

Usage in YAML config:
```yaml
model_list:
  - model_name: vertex-claude-sonnet
    litellm_params:
      model: vertex_ai/claude-sonnet-4@20250514
      exclude_anthropic_beta_values:
        - "context-1m-2025-08-07"
```

Changes:
- Add exclude_anthropic_beta_values field to GenericLiteLLMParams
- Filter beta values in VertexAIAnthropicConfig.transform_request()
- Filter beta headers in VertexAIPartnerModelsAnthropicMessagesConfig
- Add unit tests for both handlers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove unused imports flagged by ruff:
- json, verbose_logger from http_handler.py
- Iterator, litellm, InteractionsAPIResponse from streaming_iterator.py
- Optional, Query from endpoints.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants