From 16b02ae93bfe8a85179f627423245891f43c0143 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Wed, 25 Feb 2026 22:14:58 +0000 Subject: [PATCH] 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 --- docs/my-website/docs/proxy/request_tags.md | 44 +++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/docs/my-website/docs/proxy/request_tags.md b/docs/my-website/docs/proxy/request_tags.md index c78c48229b4..d8ec27410b3 100644 --- a/docs/my-website/docs/proxy/request_tags.md +++ b/docs/my-website/docs/proxy/request_tags.md @@ -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`: