Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
aac04d5
fix: SSO PKCE support fails in multi-pod Kubernetes deployments
Harshit28j Feb 3, 2026
768f9a4
fix: virutal key grace period from env/UI
Harshit28j Feb 3, 2026
6540113
fix: refactor, race condition handle, fstring sql injection
Harshit28j Feb 3, 2026
1792b3c
fix: add async call to avoid server pauses
Harshit28j Feb 12, 2026
bc5543c
Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
Harshit28j Feb 12, 2026
eb249b2
fix: add await in tests
Harshit28j Feb 12, 2026
847402b
Merge branch 'fix/sso_PKCE_deployments' of https://github.com/Harshit…
Harshit28j Feb 12, 2026
e084638
add modify test to perform async run
Harshit28j Feb 12, 2026
a2b4728
Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
Harshit28j Feb 12, 2026
c56bbb9
Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
Harshit28j Feb 12, 2026
673b7d1
Merge branch 'main' into litellm_fix-virtual-key-grace-period
Harshit28j Feb 13, 2026
f87b12a
fix grace period with better error handling on frontend and as per be…
Harshit28j Feb 13, 2026
37fc4a3
Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
Harshit28j Feb 13, 2026
f33a7ca
fix: as per request changes
Harshit28j Feb 13, 2026
d90f3d5
Update litellm/proxy/utils.py
Harshit28j Feb 14, 2026
bac6d11
Fix errors when callbacks are invoked for file delete operations:
ephrimstanley Feb 14, 2026
1b6a7ed
Fix errors when callbacks are invoked for file operations
ephrimstanley Feb 14, 2026
358180e
Fix: pass deployment credentials to afile_retrieve in managed_files p…
ephrimstanley Feb 14, 2026
5433ae7
Fix: bypass managed files access check in batch polling by calling af…
ephrimstanley Feb 14, 2026
3743513
Update tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
Harshit28j Feb 14, 2026
e59c8d2
fix: afile_retrieve returns unified ID for batch output files
ephrimstanley Feb 14, 2026
cd0fed8
fix: batch retrieve returns unified input_file_id
ephrimstanley Feb 14, 2026
ab2d6e4
fix(chatgpt): drop unsupported responses params for Codex
jayy-77 Feb 14, 2026
35bbcf9
test(chatgpt): ensure Codex request filters unsupported params
jayy-77 Feb 14, 2026
4d87cb8
Fix deleted managed files returning 403 instead of 404
ephrimstanley Feb 15, 2026
a562676
Add comments
ephrimstanley Feb 15, 2026
2c654bd
Update litellm/proxy/utils.py
Harshit28j Feb 15, 2026
56b53cb
Merge branch 'main' into litellm_fix-virtual-key-grace-period
Harshit28j Feb 15, 2026
7d794b5
fix: thread deployment model_info through batch cost calculation
ephrimstanley Feb 15, 2026
32adfa2
fix(deps): add pytest-postgresql for db schema migration tests
jquinter Feb 15, 2026
4f2c7d3
fix(test): replace caplog with custom handler for parallel execution
jquinter Feb 15, 2026
8ea0c93
fix(test): correct async mock for video generation logging test
jquinter Feb 15, 2026
cc2dff0
fix(test): add cleanup fixture and no_parallel mark for MCP tests
jquinter Feb 15, 2026
1deb445
Regenerate poetry.lock with Poetry 2.3.2
jquinter Feb 16, 2026
fe691ca
Remove unused pytest import and add trailing newline
jquinter Feb 16, 2026
f2b6c38
Remove redundant import inside test method
jquinter Feb 16, 2026
01cdec5
Fix converse anthropic usage object according to v1/messages specs
Sameerlite Feb 16, 2026
ee9e997
Add routing based on if reasoning is supported or not
Sameerlite Feb 16, 2026
c00c5a6
add fireworks_ai/accounts/fireworks/models/kimi-k2p5 in model map
Sameerlite Feb 16, 2026
cc4e022
Removed stray .md file
ephrimstanley Feb 16, 2026
3347fab
Merge pull request #21209 from jayy-77/fix/21193-chatgpt-codex-unsupp…
Sameerlite Feb 16, 2026
37da38f
fix(bedrock): clamp thinking.budget_tokens to minimum 1024
mjkam Feb 16, 2026
4976029
Merge pull request #21302 from BerriAI/litellm_kilo_ai
Sameerlite Feb 16, 2026
70a49a4
Merge pull request #21295 from BerriAI/litellm_correct_converse_usage
Sameerlite Feb 16, 2026
43f9a58
fix: improve Langfuse test isolation to prevent flaky failures (#21093)
jquinter Feb 14, 2026
9c71d8b
feat(s3): add support for virtual-hosted-style URLs (#21094)
tuzkiyoung Feb 14, 2026
a3762e7
Addressed greptile comments to extract common helpers and return 404
ephrimstanley Feb 16, 2026
51b1b03
Allow effort="max" for Claude Opus 4.6 (#21112)
KristofferArlind Feb 14, 2026
7ef9083
fix(aiohttp): prevent closing shared ClientSession in AiohttpTranspor…
runixer Feb 14, 2026
06e7bfc
perf(spend): avoid duplicate daily agent transaction computation (#21…
emerzon Feb 14, 2026
72a1bd6
Merge pull request #21157 from Point72/ephrimstanley/s3-logger-skip-m…
Sameerlite Feb 16, 2026
27890dd
Merge pull request #21306 from mjkam/fix/bedrock-min-budget-tokens
Sameerlite Feb 16, 2026
ac2f17a
fix: proxy/batches_endpoints/endpoints.py:309:11: PLR0915 Too many st…
Sameerlite Feb 16, 2026
4548d9f
fix mypy
Sameerlite Feb 16, 2026
a38b4c8
Add doc for OpenAI Agents SDK with LiteLLM
Sameerlite Feb 16, 2026
5b6e232
Add doc for OpenAI Agents SDK with LiteLLM
Sameerlite Feb 16, 2026
be9df25
Update docs/my-website/sidebars.js
Sameerlite Feb 16, 2026
6ceebdc
fix mypy
Sameerlite Feb 16, 2026
0f2b086
Merge pull request #21311 from BerriAI/litellm_add_agents_sdk_openai
Sameerlite Feb 16, 2026
86a254a
Merge pull request #21307 from BerriAI/litellm_oss_staging_02_14_20262
Sameerlite Feb 16, 2026
dd2111e
Merge pull request #20321 from Harshit28j/litellm_fix-virtual-key-gra…
Harshit28j Feb 16, 2026
1308a2c
Merge pull request #20314 from Harshit28j/fix/sso_PKCE_deployments
Harshit28j Feb 16, 2026
af9b6f6
Merge main into fix/add-pytest-postgresql-dependency
jquinter Feb 16, 2026
a2ce7fc
Merge pull request #21280 from BerriAI/fix/add-pytest-postgresql-depe…
jquinter Feb 16, 2026
8786154
Merge pull request #21282 from BerriAI/fix/cost-calculation-log-test-…
jquinter Feb 16, 2026
d84336b
Merge pull request #21283 from BerriAI/fix/video-generation-logging-mock
jquinter Feb 16, 2026
c3fb5e1
Update tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_ser…
jquinter Feb 16, 2026
bf93ce8
Merge pull request #21284 from BerriAI/fix/mcp-server-test-mocks
jquinter Feb 16, 2026
2ad648a
Add blog fffor Managing Anthropic Beta Headers
Sameerlite Feb 16, 2026
e67641c
Add blog fffor Managing Anthropic Beta Headers
Sameerlite Feb 16, 2026
452f481
correct the time
Sameerlite Feb 16, 2026
351e834
Merge pull request #21320 from BerriAI/litellm_anthropic_doc_beta_header
Sameerlite Feb 16, 2026
7bcef14
Fix: Exclude tool params for models without function calling support …
AtharvaJaiswal005 Feb 16, 2026
89e95f7
fix(index.md): cleanup str
krrishdholakia Feb 16, 2026
0dcc744
fix(proxy): handle missing DATABASE_URL in append_query_params (#21239)
vincentkoc Feb 16, 2026
035f091
fix(mcp): revert StreamableHTTPSessionManager to stateless mode (#21323)
michelligabriele Feb 16, 2026
45690db
UI - Content Filters, help edit/view categories and 1-click add categ…
krrishdholakia Feb 16, 2026
90edd98
Fix OCI Grok output pricing (#21329)
ishaan-jaff Feb 16, 2026
1daea57
fix(proxy): fix master key rotation Prisma validation errors
michelligabriele Feb 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions docs/my-website/blog/claude_code_beta_headers/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
---
slug: claude_code_beta_headers
title: "Claude Code - Managing Anthropic Beta Headers"
date: 2026-02-16T10:00:00
authors:
- name: Sameer Kankute
title: SWE @ LiteLLM (LLM Translation)
url: https://www.linkedin.com/in/sameer-kankute/
image_url: https://pbs.twimg.com/profile_images/2001352686994907136/ONgNuSk5_400x400.jpg
- name: Ishaan Jaff
title: "CTO, LiteLLM"
url: https://www.linkedin.com/in/reffajnaahsi/
image_url: https://pbs.twimg.com/profile_images/1613813310264340481/lz54oEiB_400x400.jpg
- name: Krrish Dholakia
title: "CEO, LiteLLM"
url: https://www.linkedin.com/in/krish-d/
image_url: https://pbs.twimg.com/profile_images/1298587542745358340/DZv3Oj-h_400x400.jpg
description: "How to manage and configure Anthropic beta headers with Claude Code in LiteLLM: filtering, mapping, and dynamic updates across providers."
tags: [anthropic, claude, beta headers, configuration, liteLLM]
hide_table_of_contents: false

---
import Image from '@theme/IdealImage';

When using Claude Code with LiteLLM and non-Anthropic providers (Bedrock, Azure AI, Vertex AI), you need to ensure that only supported beta headers are sent to each provider. This guide explains how to add support for new beta headers or fix invalid beta header errors.

## What Are Beta Headers?

Anthropic uses beta headers to enable experimental features in Claude. When you use Claude Code, it may send beta headers like:

```
anthropic-beta: prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20
```

However, not all providers support all Anthropic beta features. LiteLLM uses `anthropic_beta_headers_config.json` to manage which beta headers are supported by each provider.

## Common Error Message

```bash
Error: The model returned the following errors: invalid beta flag
```

## How LiteLLM Handles Beta Headers

LiteLLM uses a strict validation approach with a configuration file:

```
litellm/litellm/anthropic_beta_headers_config.json
```

This JSON file contains a **mapping** of beta headers for each provider:
- **Keys**: Input beta header names (from Anthropic)
- **Values**: Provider-specific header names (or `null` if unsupported)
- **Validation**: Only headers present in the mapping with non-null values are forwarded

This enforces stricter validation than just filtering unsupported headers - headers must be explicitly defined to be allowed.

## Adding Support for a New Beta Header

When Anthropic releases a new beta feature, you need to add it to the configuration file for each provider.

### Step 1: Add the New Beta Header

Open `anthropic_beta_headers_config.json` and add the new header to each provider's mapping:

```json title="anthropic_beta_headers_config.json"
{
"description": "Mapping of Anthropic beta headers for each provider. Keys are input header names, values are provider-specific header names (or null if unsupported). Only headers present in mapping keys with non-null values can be forwarded.",
"anthropic": {
"advanced-tool-use-2025-11-20": "advanced-tool-use-2025-11-20",
"new-feature-2026-03-01": "new-feature-2026-03-01",
...
},
"azure_ai": {
"advanced-tool-use-2025-11-20": "advanced-tool-use-2025-11-20",
"new-feature-2026-03-01": "new-feature-2026-03-01",
...
},
"bedrock_converse": {
"advanced-tool-use-2025-11-20": "tool-search-tool-2025-10-19",
"new-feature-2026-03-01": null,
...
},
"bedrock": {
"advanced-tool-use-2025-11-20": "tool-search-tool-2025-10-19",
"new-feature-2026-03-01": null,
...
},
"vertex_ai": {
"advanced-tool-use-2025-11-20": "tool-search-tool-2025-10-19",
"new-feature-2026-03-01": null,
...
}
}
```

**Key Points:**
- **Supported headers**: Set the value to the provider-specific header name (often the same as the key)
- **Unsupported headers**: Set the value to `null`
- **Header transformations**: Some providers use different header names (e.g., Bedrock maps `advanced-tool-use-2025-11-20` to `tool-search-tool-2025-10-19`)
- **Alphabetical order**: Keep headers sorted alphabetically for maintainability

### Step 2: Reload Configuration (No Restart Required!)

**Option 1: Dynamic Reload Without Restart**

Instead of restarting your application, you can dynamically reload the beta headers configuration using environment variables and API endpoints:

```bash
# Set environment variable to fetch from remote URL (Do this if you want to point it to some other URL)
export LITELLM_ANTHROPIC_BETA_HEADERS_URL="https://raw.githubusercontent.com/BerriAI/litellm/main/litellm/anthropic_beta_headers_config.json"

# Manually trigger reload via API (no restart needed!)
curl -X POST "https://your-proxy-url/reload/anthropic_beta_headers" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
```

**Option 2: Schedule Automatic Reloads**

Set up automatic reloading to always stay up-to-date with the latest beta headers:

```bash
# Reload configuration every 24 hours
curl -X POST "https://your-proxy-url/schedule/anthropic_beta_headers_reload?hours=24" \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"
```

**Option 3: Traditional Restart**

If you prefer the traditional approach, restart your LiteLLM proxy or application:

```bash
# If using LiteLLM proxy
litellm --config config.yaml

# If using Python SDK
# Just restart your Python application
```

:::tip Zero-Downtime Updates
With dynamic reloading, you can fix invalid beta header errors **without restarting your service**! This is especially useful in production environments where downtime is costly.

See [Auto Sync Anthropic Beta Headers](../proxy/sync_anthropic_beta_headers.md) for complete documentation.
:::

## Fixing Invalid Beta Header Errors

If you encounter an "invalid beta flag" error, it means a beta header is being sent that the provider doesn't support.

### Step 1: Identify the Problematic Header

Check your logs to see which header is causing the issue:

```bash
Error: The model returned the following errors: invalid beta flag: new-feature-2026-03-01
```

### Step 2: Update the Config

Set the header value to `null` for that provider:

```json title="anthropic_beta_headers_config.json"
{
"bedrock_converse": {
"new-feature-2026-03-01": null
}
}
```

### Step 3: Restart and Test

Restart your application and verify the header is now filtered out.

## Contributing a Fix to LiteLLM

Help the community by contributing your fix!

### What to Include in Your PR

1. **Update the config file**: Add the new beta header to `litellm/anthropic_beta_headers_config.json`
2. **Test your changes**: Verify the header is correctly filtered/mapped for each provider
3. **Documentation**: Include provider documentation links showing which headers are supported

### Example PR Description

```markdown
## Add support for new-feature-2026-03-01 beta header

### Changes
- Added `new-feature-2026-03-01` to anthropic_beta_headers_config.json
- Set to `null` for bedrock_converse (unsupported)
- Set to header name for anthropic, azure_ai (supported)

### Testing
Tested with:
- βœ… Anthropic: Header passed through correctly
- βœ… Azure AI: Header passed through correctly
- βœ… Bedrock Converse: Header filtered out (returns error without fix)

### References
- Anthropic docs: [link]
- AWS Bedrock docs: [link]
```


## How Beta Header Filtering Works

When you make a request through LiteLLM:

```mermaid
sequenceDiagram
participant CC as Claude Code
participant LP as LiteLLM
participant Config as Beta Headers Config
participant Provider as Provider (Bedrock/Azure/etc)

CC->>LP: Request with beta headers
Note over CC,LP: anthropic-beta: header1,header2,header3

LP->>Config: Load header mapping for provider
Config-->>LP: Returns mapping (header→value or null)

Note over LP: Validate & Transform:<br/>1. Check if header exists in mapping<br/>2. Filter out null values<br/>3. Map to provider-specific names

LP->>Provider: Request with filtered & mapped headers
Note over LP,Provider: anthropic-beta: mapped-header2<br/>(header1, header3 filtered out)

Provider-->>LP: Success response
LP-->>CC: Response
```

### Filtering Rules

1. **Header must exist in mapping**: Unknown headers are filtered out
2. **Header must have non-null value**: Headers with `null` values are filtered out
3. **Header transformation**: Headers are mapped to provider-specific names (e.g., `advanced-tool-use-2025-11-20` β†’ `tool-search-tool-2025-10-19` for Bedrock)

### Example

Request with headers:
```
anthropic-beta: advanced-tool-use-2025-11-20,computer-use-2025-01-24,unknown-header
```

For Bedrock Converse:
- βœ… `computer-use-2025-01-24` β†’ `computer-use-2025-01-24` (supported, passed through)
- ❌ `advanced-tool-use-2025-11-20` β†’ filtered out (null value in config)
- ❌ `unknown-header` β†’ filtered out (not in config)

Result sent to Bedrock:
```
anthropic-beta: computer-use-2025-01-24
```

## Dynamic Configuration Management (No Restart Required!)

### Environment Variables

Control how LiteLLM loads the beta headers configuration:

| Variable | Description | Default |
|----------|-------------|---------|
| `LITELLM_ANTHROPIC_BETA_HEADERS_URL` | URL to fetch config from | GitHub main branch |
| `LITELLM_LOCAL_ANTHROPIC_BETA_HEADERS` | Set to `True` to use local config only | `False` |

**Example: Use Custom Config URL**
```bash
export LITELLM_ANTHROPIC_BETA_HEADERS_URL="https://your-company.com/custom-beta-headers.json"
```

**Example: Use Local Config Only (No Remote Fetching)**
```bash
export LITELLM_LOCAL_ANTHROPIC_BETA_HEADERS=True
```
2 changes: 1 addition & 1 deletion docs/my-website/blog/claude_opus_4_6/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ curl --location 'http://0.0.0.0:4000/chat/completions' \
model_list:
- model_name: claude-opus-4-6
litellm_params:
model: bedrock/anthropic.claude-opus-4-6-v1:0
model: bedrock/anthropic.claude-opus-4-6-v1
aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID
aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY
aws_region_name: us-east-1
Expand Down
Loading
Loading