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

# Router

> Learn how to route requests to different providers and how our billing and high-availability features work.

## How Routing Works

YouRouter offers two modes for routing your API requests: automatic and manual. This behavior is controlled by the `vendor` header.

### Default Behavior: Automatic Routing (`auto`)

For maximum reliability, we recommend using our automatic routing mode. This is the default behavior if you omit the `vendor` header or set it to `auto`.

In `auto` mode, YouRouter intelligently routes your request to the most available and cost-effective provider for the requested model. For example, if you request `gpt-4o` and OpenAI's API is experiencing latency, we will seamlessly failover to another provider like Azure OpenAI to ensure your request is processed without interruption. This is the ideal setting for production applications where high availability is critical.

### Manual Routing: Specifying a Provider

If you need to use a specific model from a particular provider or access a provider-exclusive feature, you can manually route your request. To do this, simply set the `vendor` header to the desired provider's ID.

For instance, to guarantee your `gpt-4o` request is handled by Azure, you would include `vendor: azure` in your request header.

<CodeGroup>
  ```python Python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["YOUROUTER_API_KEY"],
      base_url="https://api.yourouter.ai/v1"
  )

  response = client.chat.completions.create(
      model="gpt-4o",
      messages=[{"role": "user", "content": "Hello from Azure OpenAI!"}],
      extra_headers={"vendor": "azure"}
  )

  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl https://api.yourouter.ai/v1/chat/completions \
    -H "Authorization: Bearer $YOUROUTER_API_KEY" \
    -H "Content-Type: application/json" \
    -H "vendor: openai" \
    -d '{
      "model": "gpt-4o",
      "messages": [{"role": "user", "content": "Hello from OpenAI!"}]
    }'
  ```
</CodeGroup>

### Available Providers

| Provider     | `vendor` Value |
| ------------ | -------------- |
| Anthropic    | `anthropic`    |
| AWS Bedrock  | `aws`          |
| Azure OpenAI | `azure`        |
| DeepSeek     | `deepseek`     |
| Google       | `google`       |
| Mistral AI   | `mistral`      |
| OpenAI       | `openai`       |
| Volcengine   | `volcengine`   |
| xAI          | `x`            |

## Zero Completion Insurance

Our fair billing policy ensures you only pay for successful, non-empty responses. You will not be charged for requests that result in an error (e.g., a 500 status code) or return zero completion tokens. This is our Zero Completion Insurance, and it's enabled by default on all requests.

## Best Practices

* **Use `auto` for Production**: For any application where uptime is important, we strongly recommend using the default `auto` mode to benefit from our automatic failover and high-availability routing.
* **Use Manual Routing for Specific Needs**: If you require a model or feature unique to one provider, specify the provider using the `vendor` header.
* **Consult Provider-Specific Docs**: When using manual routing to access special features, always refer to the native provider's documentation for detailed parameter information. You can pass these parameters directly through YouRouter, as explained in our [Request Forwarding](/features/request-forwarding) guide.

See our [Chat Completions](/guides/chat-completions) guide for more detailed API examples.
