Related to #19017
This commit adds comprehensive documentation and examples for configuring
custom User-Agent headers in LiteLLM proxy for Anthropic requests.
Changes:
- Added example proxy config: anthropic_custom_user_agent_config.yaml
showing all three methods to customize User-Agent
- Added detailed README: README_ANTHROPIC_USER_AGENT.md explaining:
* Problem statement (Claude Code credential restrictions)
* Three configuration methods (per-model, env var, extra_headers)
* Priority order for User-Agent resolution
* Complete examples for proxy and Python SDK usage
- Added comprehensive proxy unit tests in test_anthropic_custom_user_agent.py
testing all configuration methods and priority order
Users can now configure custom User-Agent in proxy YAML:
```yaml
model_list:
- model_name: claude-code
litellm_params:
model: anthropic/claude-3-5-sonnet-20241022
custom_user_agent: "Claude Code/1.0"
```
Or via environment variable:
```bash
export ANTHROPIC_USER_AGENT="Claude Code/1.0"
```
Fixes#19017
This commit adds the ability to customize the User-Agent header for
Anthropic/Claude API requests to avoid credential blocks when using
restricted API keys (e.g., Claude Code credentials).
Changes:
- Added `custom_user_agent` parameter support in AnthropicConfig
- Added `ANTHROPIC_USER_AGENT` environment variable support
- Modified validate_environment() to set User-Agent header when custom
value is provided
- Added comprehensive unit tests for custom User-Agent functionality
Priority order for User-Agent:
1. custom_user_agent parameter
2. ANTHROPIC_USER_AGENT environment variable
3. User-Agent in extra_headers
4. Default litellm/{version}
Users can now override the User-Agent by:
- Passing custom_user_agent parameter:
litellm.completion(model="anthropic/...", custom_user_agent="Claude Code/1.0")
- Setting environment variable:
export ANTHROPIC_USER_AGENT="Claude Code/1.0"
- Using extra_headers:
litellm.completion(model="anthropic/...", extra_headers={"User-Agent": "..."})
Add documentation explaining the difference between model formats:
- `gemini/model` → Gemini API (simple API key)
- `vertex_ai/model` → Vertex AI (GCP credentials)
- `model` (no prefix) → defaults to Vertex AI
This addresses user confusion when models without prefix require
GCP authentication instead of simple API key auth.
Ref #8424
- Add google-cloud-aiplatform as optional dependency in pyproject.toml
- Add 'google' extra for easy installation: pip install litellm[google]
- Improve error messages when Google SDK is not installed to guide users
Fixes#5483
Replace independent auto-incrementing chart versioning with 1-1 sync
to LiteLLM version. This allows users to easily map Helm chart versions
to LiteLLM versions without needing to inspect appVersion.
Changes:
- Remove auto-increment logic that read from OCI registry
- Chart version now equals LiteLLM tag without 'v' prefix (v1.81.0 -> 1.81.0)
- appVersion equals full Docker tag (v1.81.0)
- Update both ghcr_deploy.yml and ghcr_helm_deploy.yml workflows
Before: helm chart 0.1.837 -> user has to guess LiteLLM version
After: helm chart 1.81.0 -> matches LiteLLM v1.81.0
References:
- https://codefresh.io/docs/docs/ci-cd-guides/helm-best-practices/