> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart Routing

## Introduction

Smart Routing is an intelligent model routing capability that automatically assigns requests to the most suitable model based on the complexity of the input task. By dividing tasks into three levels — **simple**, **complex**, and **ultra** (flagship) — Smart Routing can effectively reduce API call costs while maintaining output quality. Ultra serves as the price benchmark.

### Usage Constraints

**Cache Capability Constraints**

During routing, the caching feature will be affected. Different models have different caching mechanisms and cache nodes. When switching models, the cache will be flushed and cannot be reused.

**Request Body Structure Constraints**

Smart Routing uses the `/v1/chat/completions` endpoint. When the routing target is a Claude series model, it can only work through OpenAI compatibility mode. For feature constraints after compatibility, please refer to the Anthropic official documentation [OpenAI SDK compatibility](https://platform.claude.com/docs/en/cli-sdks-libraries/libraries/openai-sdk).

### Usage Guide

1. Create a route

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/35UMqVTCuMQi8uxs/images/smart-routing-1.png?fit=max&auto=format&n=35UMqVTCuMQi8uxs&q=85&s=52b85562775173efaa75de39aee75177" alt="Smart Routing 1" width="475" height="797" data-path="images/smart-routing-1.png" />
</Frame>

2. Create an API key for the route node

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/35UMqVTCuMQi8uxs/images/smart-routing-2.png?fit=max&auto=format&n=35UMqVTCuMQi8uxs&q=85&s=8bd380bb4b1382da5a39d99bf61df627" alt="Smart Routing 2" width="2235" height="546" data-path="images/smart-routing-2.png" />
</Frame>

3. Select the Default group for the API key

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/35UMqVTCuMQi8uxs/images/smart-routing-3.png?fit=max&auto=format&n=35UMqVTCuMQi8uxs&q=85&s=90a1f8639c569aad34c4dd0c7e860d5c" alt="Smart Routing 3" width="1620" height="1302" data-path="images/smart-routing-3.png" />
</Frame>

4. Set the corresponding models for the three levels: simple, complex, and ultra

<Frame>
  <img src="https://mintcdn.com/personal-a5418d9f/35UMqVTCuMQi8uxs/images/smart-routing-4.png?fit=max&auto=format&n=35UMqVTCuMQi8uxs&q=85&s=45eeff76775a4f9f8e24809e3fbe68f5" alt="Smart Routing 4" width="2234" height="1509" data-path="images/smart-routing-4.png" />
</Frame>

5. Configure and route through the smart gateway

* Communication endpoint: `https://api.mixroute.ai/v1/chat/completions`
* Model name: `auto`
* API Key: Use the route's API key

```bash theme={null}
curl https://api.mixroute.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_ROUTING_KEY" \
  -d '{
    "model": "auto",
    "messages": [
      {"role": "user", "content": "Hello"}
    ]
  }'
```
