mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-06 06:24:16 +00:00
Litellm doc fixes 05 31 2025 (#11305)
* docs: cleanup * docs: add anthropic file tutorial * docs: add to sidebar
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
# Using Anthropic File API with LiteLLM Proxy
|
||||
|
||||
## Overview
|
||||
|
||||
This tutorial shows how to create and analyze files with Claude-4 on Anthropic via LiteLLM Proxy.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- LiteLLM Proxy running
|
||||
- Anthropic API key
|
||||
|
||||
Add the following to your `.env` file:
|
||||
```
|
||||
ANTHROPIC_API_KEY=sk-1234
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### 1. Setup config.yaml
|
||||
|
||||
```yaml
|
||||
model_list:
|
||||
- model_name: claude-opus
|
||||
litellm_params:
|
||||
model: anthropic/claude-opus-4-20250514
|
||||
api_key: os.environ/ANTHROPIC_API_KEY
|
||||
```
|
||||
|
||||
## 2. Create a file
|
||||
|
||||
Use the `/anthropic` passthrough endpoint to create a file.
|
||||
|
||||
```bash
|
||||
curl -L -X POST 'http://0.0.0.0:4000/anthropic/v1/files' \
|
||||
-H 'x-api-key: sk-1234' \
|
||||
-H 'anthropic-version: 2023-06-01' \
|
||||
-H 'anthropic-beta: files-api-2025-04-14' \
|
||||
-F 'file=@"/path/to/your/file.csv"'
|
||||
```
|
||||
|
||||
Expected response:
|
||||
|
||||
```json
|
||||
{
|
||||
"created_at": "2023-11-07T05:31:56Z",
|
||||
"downloadable": false,
|
||||
"filename": "file.csv",
|
||||
"id": "file-1234",
|
||||
"mime_type": "text/csv",
|
||||
"size_bytes": 1,
|
||||
"type": "file"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 3. Analyze the file with Claude-4 via `/chat/completions`
|
||||
|
||||
|
||||
```bash
|
||||
curl -L -X POST 'http://0.0.0.0:4000/v1/chat/completions' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'Authorization: Bearer $LITELLM_API_KEY' \
|
||||
-d '{
|
||||
"model": "claude-opus",
|
||||
"messages": [
|
||||
{
|
||||
"role": "user",
|
||||
"content": [
|
||||
{"type": "text", "text": "What is in this sheet?"},
|
||||
{
|
||||
"type": "file",
|
||||
"file": {
|
||||
"file_id": "file-1234",
|
||||
"format": "text/csv" # 👈 IMPORTANT: This is the format of the file you want to analyze
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}'
|
||||
```
|
||||
@@ -46,9 +46,14 @@ pip install litellm==1.72.0
|
||||
LiteLLM v1.72.0-stable is live now. Here are the key highlights of this release:
|
||||
|
||||
- **Vector Store Permissions**: Control Vector Store access at the Key, Team, and Organization level.
|
||||
- **Bedrock Agents**: Call Bedrock Agents with `/chat/completions`, `/response` endpoints.
|
||||
- **Rate Limiting Sliding Window support**: Improved accuracy for Key/Team/User rate limits with request tracking across minutes.
|
||||
- **Aiohttp Transport used by default**: Aiohttp transport is now the default transport for LiteLLM networking requests. This gives users 2x higher RPS per instance with a 40ms median latency overhead.
|
||||
- **Prometheus**: End users (`end_user`) will no longer be tracked by default on Prometheus. Tracking end_users on prometheus is now opt-in. This is done to reduce the cardinality of the metrics from LiteLLM Proxy. [Read More](../../docs/proxy/prometheus#tracking-end_user-on-prometheus)
|
||||
- **Bedrock Agents**: Call Bedrock Agents with `/chat/completions`, `/response` endpoints.
|
||||
- **Anthropic File API**: Upload and analyze CSV files with Claude-4 on Anthropic via LiteLLM.
|
||||
- **Prometheus**: End users (`end_user`) will no longer be tracked by default on Prometheus. Tracking end_users on prometheus is now opt-in. This is done to prevent the response from `/metrics` from becoming too large. [Read More](../../docs/proxy/prometheus#tracking-end_user-on-prometheus)
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Vector Store Permissions
|
||||
|
||||
@@ -58,6 +63,7 @@ This is great for use cases that require access to restricted data that you don'
|
||||
|
||||
Over the next week we plan on adding permission management for MCP Servers.
|
||||
|
||||
---
|
||||
## Aiohttp Transport used by default
|
||||
|
||||
Aiohttp transport is now the default transport for LiteLLM networking requests. This gives users 2x higher RPS per instance with a 40ms median latency overhead. This has been live on LiteLLM Cloud for a week + gone through alpha users testing for a week.
|
||||
@@ -88,6 +94,7 @@ result = litellm.completion(
|
||||
print(result)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
## New Models / Updated Models
|
||||
|
||||
@@ -506,6 +506,7 @@ const sidebars = {
|
||||
items: [
|
||||
"tutorials/openweb_ui",
|
||||
"tutorials/openai_codex",
|
||||
"tutorials/anthropic_file_usage",
|
||||
"tutorials/msft_sso",
|
||||
"tutorials/prompt_caching",
|
||||
"tutorials/tag_management",
|
||||
|
||||
Reference in New Issue
Block a user