> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://doc.enterpriserouter.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://doc.enterpriserouter.com/_mcp/server.

# cURL (Unified Mode)

The unified endpoint is `POST /v1/chat/completions`. It accepts an OpenAI-compatible request body and returns an OpenAI-compatible response, regardless of which provider handles the request.

## Basic request

```bash
curl -X POST https://api.enterpriserouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

## Calling Anthropic

```bash
curl -X POST https://api.enterpriserouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "messages": [
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "What is quantum computing?"}
    ],
    "max_tokens": 512
  }'
```

## Calling Gemini

```bash
curl -X POST https://api.enterpriserouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-2.5-flash",
    "messages": [
      {"role": "user", "content": "Write a haiku about APIs."}
    ]
  }'
```

## Streaming

Add `"stream": true` to get Server-Sent Events:

```bash
curl -X POST https://api.enterpriserouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -N \
  -d '{
    "model": "anthropic/claude-sonnet-4-6",
    "messages": [
      {"role": "user", "content": "Write a short story."}
    ],
    "stream": true
  }'
```

The response is a stream of `data:` lines in OpenAI's SSE format:

```
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"Once"},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" upon"},"finish_reason":null}]}

...

data: [DONE]
```

## Tool calling

```bash
curl -X POST https://api.enterpriserouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-proxy-YOUR_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {"role": "user", "content": "What is the weather in Tokyo?"}
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get weather for a city",
          "parameters": {
            "type": "object",
            "properties": {
              "city": {"type": "string"}
            },
            "required": ["city"]
          }
        }
      }
    ],
    "tool_choice": "auto"
  }'
```

## Response format

All responses follow the OpenAI chat completion format:

```json
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "model": "anthropic/claude-sonnet-4-6",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 9,
    "total_tokens": 21
  }
}
```

For Anthropic and Gemini, the `model` field in the response includes the provider prefix (e.g., `anthropic/claude-sonnet-4-6`). For OpenAI, the response uses the provider's own model identifier (e.g., `gpt-4o`).