---
title: "[Beta] Routing based on request metadata"
url: "/docs/tutorials/tag_management"
canonical_url: "https://docs.litellm.ai/docs/tutorials/tag_management"
type: "docs"
last_updated: "2026-10-08"
summary: "Create routing rules based on request metadata."
related:
  - "/docs/tutorials/msft_sso"
  - "/docs/tutorials/proxy_features_safety"
---
# [Beta] Routing based on request metadata

> Index of all LiteLLM docs: https://docs.litellm.ai/llms.txt


Create routing rules based on request metadata.

## Setup

Add the following to your litellm proxy config yaml file.

```yaml showLineNumbers title="litellm proxy config.yaml"
router_settings:
  enable_tag_filtering: True # 👈 Key Change
```

## 1. Create a tag

On the LiteLLM UI, navigate to Experimental > Tag Management > Create Tag.

Create a tag called `private-data` and only select the allowed models for requests with this tag. Once created, you will see the tag in the Tag Management page.

## 2. Test Tag Routing

Now we will test the tag based routing rules.

### 2.1 Invalid model

This request will fail since we send `tags=["private-data"]` but the model `gpt-5.6-terra` is not in the allowed models for the `private-data` tag.

<br />

Here is an example sending the same request using the OpenAI Python SDK.
**OpenAI Python SDK**

```python showLineNumbers
from openai import OpenAI

client = OpenAI(
    api_key="sk-<your-litellm-api-key>",
    base_url="http://0.0.0.0:4000/v1/"
)

response = client.chat.completions.create(
    model="gpt-5.6-terra",
    messages=[
        {"role": "user", "content": "Hello, how are you?"}
    ],
    extra_body={
        "tags": ["private-data"]
    }
)
```

**cURL**

```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": "gpt-5.6-terra",
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ],
  "tags": ["private-data"]
}'
```

<br />

### 2.2 Valid model

This request will succeed since we send `tags=["private-data"]` and the model `us.anthropic.claude-sonnet-5` is in the allowed models for the `private-data` tag.

Here is an example sending the same request using the OpenAI Python SDK.

**OpenAI Python SDK**

```python showLineNumbers
from openai import OpenAI

client = OpenAI(
    api_key="sk-<your-litellm-api-key>",
    base_url="http://0.0.0.0:4000/v1/"
)

response = client.chat.completions.create(
    model="us.anthropic.claude-sonnet-5",
    messages=[
        {"role": "user", "content": "Hello, how are you?"}
    ],
    extra_body={
        "tags": ["private-data"]
    }
)
```

**cURL**

```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": "us.anthropic.claude-sonnet-5",
  "messages": [
    {
      "role": "user",
      "content": "Hello, how are you?"
    }
  ],
  "tags": ["private-data"]
}'
```

## Additional Tag Features
- [Sending tags in request headers](https://docs.litellm.ai/docs/proxy/tag_routing#calling-via-request-header)
- [Tag based routing](https://docs.litellm.ai/docs/proxy/tag_routing)
- [Track spend per tag](/docs/proxy/cost_tracking#custom-tags)
- [Setup Budgets per Virtual Key, Team](/docs/proxy/users)

## Related pages

- [Microsoft SSO: Sync Groups, Members with LiteLLM](https://docs.litellm.ai/docs/tutorials/msft_sso.md)
- [Proxy: Features & Safety](https://docs.litellm.ai/docs/tutorials/proxy_features_safety.md)
