# AnyRouter API documentation: base URL, model ids, and request format

> The AnyRouter API is OpenAI-compatible. Here's the base URL, model id format, authentication, and a working request example.

- Date: August 5, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/anyrouter-api-docs-primer

## Base URL

The AnyRouter API endpoint is:

```text
https://anyrouter.dev/api/v1
```

All standard OpenAI-compatible routes are under this prefix: `/v1/chat/completions`, `/v1/embeddings`, `/v1/models`, etc.

## Authentication

Pass your API key in the standard Authorization header:

```bash
curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer sk-ar-v1-placeholder" \
  -H "Content-Type: application/json" \
  -d '{"model":"anyrouter/free","messages":[{"role":"user","content":"Hi"}]}'
```

Keys start with `sk-ar-v1-`. Create one from the AnyRouter dashboard.

## Model id format

Model ids follow the `provider/model` convention:

- anthropic/claude-sonnet-4-5
- openai/gpt-5.5
- google/gemini-2.5-pro
- z-ai/glm-5.2
- anyrouter/free (shared pool free tier)

The provider prefix tells AnyRouter which upstream to route to. Omitting the prefix or using an unrecognized id returns a 404.

## Request format

The request body follows the OpenAI Chat Completions schema. The most common fields:

| Field | Type | Required | Notes |
| --- | --- | --- | --- |
| model | string | Yes | provider/model id |
| messages | array | Yes | Conversation history |
| temperature | number | No | 0–2, default 1 |
| max_tokens | integer | No | Max completion tokens |
| stream | boolean | No | Set true for SSE streaming |
| tools | array | No | Function/tool definitions |

## Streaming responses

Set `stream: true` to receive Server-Sent Events. AnyRouter forwards the upstream provider's streaming format directly. Handle the SSE stream the same way you would with the provider's native API.

## Error responses

AnyRouter returns standard HTTP status codes:

- 200, success
- 400, malformed request body
- 401, invalid or missing API key
- 404, model not found or provider not configured
- 429, rate limit exceeded (see the 429 guide)
- 500/502/503, upstream provider error or gateway issue

## Where to go from here

The full interactive API reference with every endpoint and schema is at anyrouter.dev/docs. For monitoring and debugging, use chmonitor.dev to inspect per-request traces including upstream, latency, tokens, and cost.

OpenAI-compatible API. Try 5 requests free, no card required.

[Get your API key](https://anyrouter.dev/dashboard)
