mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
docs: document x-litellm-tags header and request body tags parameter
- Add documentation for x-litellm-tags header (comma-separated or array) - Add documentation for tags in request body - Clarify that dynamic tags override config tags Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
This commit is contained in:
parent
b9dd36c14b
commit
16b02ae93b
1 changed files with 43 additions and 1 deletions
|
|
@ -27,7 +27,9 @@ model_list:
|
|||
|
||||
## Make Request
|
||||
|
||||
Requests just specify the model - tags are automatically applied:
|
||||
### Option 1: Use Config Tags (Automatic)
|
||||
|
||||
Requests just specify the model - tags are automatically applied from config:
|
||||
|
||||
```bash
|
||||
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
||||
|
|
@ -39,6 +41,46 @@ curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
|||
}'
|
||||
```
|
||||
|
||||
### Option 2: Use `x-litellm-tags` Header
|
||||
|
||||
Pass tags dynamically via the `x-litellm-tags` header:
|
||||
|
||||
```bash
|
||||
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-litellm-tags: team-stripe,production,us-east-1' \
|
||||
-d '{
|
||||
"model": "gpt-4",
|
||||
"messages": [{"role": "user", "content": "Hello"}]
|
||||
}'
|
||||
```
|
||||
|
||||
The header accepts:
|
||||
- **Comma-separated string**: `"tag1,tag2,tag3"` (spaces are trimmed)
|
||||
- **Array of strings**: `["tag1", "tag2", "tag3"]`
|
||||
|
||||
### Option 3: Use Request Body `tags`
|
||||
|
||||
Pass tags directly in the request body:
|
||||
|
||||
```bash
|
||||
curl -X POST 'http://0.0.0.0:4000/chat/completions' \
|
||||
-H 'Authorization: Bearer sk-1234' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"model": "gpt-4",
|
||||
"messages": [{"role": "user", "content": "Hello"}],
|
||||
"tags": ["team-stripe", "production", "us-east-1"]
|
||||
}'
|
||||
```
|
||||
|
||||
The `tags` field must be an array of strings.
|
||||
|
||||
:::info
|
||||
When tags are provided via header or request body, they override any tags configured in the model deployment.
|
||||
:::
|
||||
|
||||
## Spend Logs
|
||||
|
||||
The tag from the model config appears in `LiteLLM_SpendLogs`:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue