# One OpenAI-compatible API for every model

> An OpenAI-compatible gateway lets you keep your client and change two settings. This post shows the four API shapes behind one AnyRouter base URL, a working request, and how model ids are written.

- Date: December 4, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/openai-compatible-llm-gateway

## What does OpenAI-compatible mean?

Many apps already talk to the OpenAI API. An OpenAI-compatible gateway accepts those same requests, so you do not rewrite the client.

The gateway then routes the request to the model you named. AnyRouter is an [LLM gateway](https://anyrouter.dev/llm-gateway): one API key, one base URL, and hundreds of models behind it.



## Which API shapes sit behind one base URL?

AnyRouter serves four shapes at https://anyrouter.dev/api/v1. Pick the one your client already speaks.

| API shape | Path under the base URL |
| --- | --- |
| OpenAI Chat Completions | /chat/completions |
| OpenAI Responses | /responses |
| OpenAI Embeddings | /embeddings |
| Anthropic Messages | /messages |

The [Chat Completions page](https://anyrouter.dev/unify-api/chat-completions) shows the unified shape in detail.

## How do I switch an existing client?



### curl

```bash
export ANYROUTER_API_KEY="sk-ar-v1-your-key"

curl https://anyrouter.dev/api/v1/chat/completions \
  -H "Authorization: Bearer $ANYROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anyrouter/free",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
```

### OpenAI SDK (Python)

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://anyrouter.dev/api/v1",
    api_key="sk-ar-v1-your-key",
)

response = client.chat.completions.create(
    model="anyrouter/free",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
```

### OpenAI SDK (TypeScript)

```typescript
import OpenAI from "openai"

const client = new OpenAI({
  baseURL: "https://anyrouter.dev/api/v1",
  apiKey: "sk-ar-v1-your-key",
})

const response = await client.chat.completions.create({
  model: "anyrouter/free",
  messages: [{ role: "user", content: "Hello!" }],
})
console.log(response.choices[0].message.content)
```

The full walkthrough is the [quickstart](https://anyrouter.dev/docs/getting-started/quickstart). For the Vercel AI SDK, see the [AI SDK page](https://anyrouter.dev/use-cases/ai-sdk).

## How are model ids written?

Every id has the form provider/model. The part before the slash names the provider or owner. The part after it names the model.

- moonshotai/kimi-k3.1-pro is a model from moonshotai.
- anyrouter/free asks AnyRouter to pick a working free model.

Browse every id on the [models page](https://anyrouter.dev/models). Switching models means changing one string. If one upstream fails, [model fallbacks](https://anyrouter.dev/docs/guides/model-fallbacks) can retry on another.

## Where do I go next?

Read [Unify an LLM API](/blog/unify-llm-api) for the idea behind one endpoint, and [one endpoint for every AI API](/blog/unified-ai-api-one-endpoint) for the wider set of shapes. For routing and failover in general, see the [LLM gateway](https://anyrouter.dev/llm-gateway) page. To use your own provider keys, read [BYOK](https://anyrouter.dev/byok).

## Official site

The official AnyRouter domain is https://anyrouter.dev, shortened as https://anyr.dev. It is the only valid domain for the API, docs, models, pricing and terms.

Sites on other domains that use the AnyRouter name are clones and are not affiliated with AnyRouter. Check the domain before you send API keys or payments.
