# Migrate from OpenRouter: base URL and model IDs

> Switch OpenRouter code to BigModel.io by changing the base URL and key. provider/model IDs, the models fallback array and HTTP-Referer / X-Title attribution keep working.

Web version: https://bigmodel.io/docs/migrate-from-openrouter · Updated 2026-10-18

BigModel.io accepts the main OpenRouter request conventions on `/v1/chat/completions`, `/v1/messages` and `/v1/responses`, so most OpenRouter integrations move by changing the base URL and the key.

| | OpenRouter | BigModel.io |
|---|---|---|
| Base URL | `https://openrouter.ai/api/v1` | `https://bigmodel.io/v1` |
| API key | `sk-or-...` | your BigModel.io key from [API Keys](https://bigmodel.io/keys) |
| Endpoints | `/chat/completions`, `/responses`, `/messages` | the same paths under `/v1`, depending on the key's group |
| Model IDs | `provider/model` | plain IDs like `glm-5.3`; `provider/model` is also accepted |
| Fallback | `models` array | `models` array, up to 5 models in total |
| Billing | USD credits | USD balance, prices per model on [/models](https://bigmodel.io/models) |

```python [Python]
from openai import OpenAI
import os

client = OpenAI(
    base_url="https://bigmodel.io/v1",       # was https://openrouter.ai/api/v1
    api_key=os.environ["BIGMODEL_API_KEY"],  # was OPENROUTER_API_KEY
)
```

```js [Node.js]
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://bigmodel.io/v1",        // was https://openrouter.ai/api/v1
  apiKey: process.env.BIGMODEL_API_KEY,     // was OPENROUTER_API_KEY
});
```

## Model names with a provider prefix

You can keep OpenRouter-style IDs. A name like `z-ai/glm-5.3` or `deepseek/deepseek-v4-pro:nitro` is resolved to a model your key's group serves:

1. The exact name is used if the group serves it.
2. Otherwise these variants are tried in order: the name without a routing suffix (`:nitro`, `:floor`, `:exacto`), then without the `provider/` prefix, then the same two with dots replaced by dashes.
3. If nothing matches, the original name is sent and the request fails with the normal "model not available" error (503 `api_error`).

`:free` is never dropped: a `:free` request is not silently served by a paid model. Plain names without `/` or `:` are never rewritten. See [Model IDs](https://bigmodel.io/docs/model-ids) for the plain IDs.

## Fallback with the models array

Send `models` as an ordered fallback list. Together with `model`, up to five models are tried per request (duplicates removed).

```python [Python]
completion = client.chat.completions.create(
    model="kimi-k3",
    messages=[{"role": "user", "content": "Summarize this diff."}],
    extra_body={"models": ["glm-5.3", "deepseek-v4-pro"]},
)
print(completion.model)
```

```js [Node.js]
const completion = await client.chat.completions.create({
  model: "kimi-k3",
  models: ["glm-5.3", "deepseek-v4-pro"],
  messages: [{ role: "user", content: "Summarize this diff." }],
});
```

The next model is tried when an attempt returns 404, 408, 429 or a 5xx **before any response bytes are sent**. Once a stream has started there is no fallback. 400, 401, 402, 403 and 413 are returned right away. `models` is removed before the request is forwarded upstream, and you are charged only for the attempt that succeeds.

## App attribution headers

`HTTP-Referer` and `X-Title` (or `X-OpenRouter-Title`) identify your app, as on OpenRouter. BigModel.io records the referer's host and the title (up to 100 characters) for successful requests, aggregated per day. Paths and query strings are never stored.

```python [Python]
client = OpenAI(
    base_url="https://bigmodel.io/v1",
    api_key=os.environ["BIGMODEL_API_KEY"],
    default_headers={"HTTP-Referer": "https://your-app.example", "X-Title": "Your App"},
)
```

The headers are optional and do not change routing or price. There is currently no user-facing view of attribution data; see [App attribution](https://bigmodel.io/docs/app-attribution).

## What is not supported

- The `provider` routing object, `transforms` and `route` are not interpreted. Requests that rely on them run without them.
- Endpoints depend on the key's group: Chat Completions-only GLM and DeepSeek groups return 404 on `/v1/messages` and `/v1/responses`.
- Test any other OpenRouter-specific request field before relying on it. The full list is in [OpenRouter compatibility](https://bigmodel.io/docs/openrouter-compat).

## Verify the setup

List the models your key can call, then compare with the IDs your code uses:

```bash
curl https://bigmodel.io/v1/models -H "Authorization: Bearer $BIGMODEL_API_KEY"
```

Send one real request from your app and check that it appears in [Usage](https://bigmodel.io/usage) with the expected model and cost.

## Troubleshooting

**503 `api_error`: `No available accounts: no available accounts supporting model: ...` with a `provider/model` name.** None of the name variants is served by your key's group. Use the plain ID from the [catalog](https://bigmodel.io/models), or a key from a group that serves the model.

**Fallback never happens.** The first model returned an error that does not trigger fallback (400, 401, 402, 403 or 413), or the stream had already started. Check the status code in [Usage](https://bigmodel.io/usage).

**401 `INVALID_API_KEY`.** You are still sending the OpenRouter key. BigModel.io keys are created in [API Keys](https://bigmodel.io/keys).

**404 on every request.** The base URL still has OpenRouter's `/api/v1` path. Use `https://bigmodel.io/v1`.

**404 `not_found_error`: `... platform only supports /v1/chat/completions`.** Your code calls `/v1/messages` or `/v1/responses` with a key from a Chat Completions-only group. Use Chat Completions, or a key from another group.

**403 with "insufficient balance".** Your balance is $0 or below and the model is not priced at $0 in your group. OpenRouter's `:free` IDs are not mapped to free models here. Top up in [Balance & billing](https://bigmodel.io/purchase), or call a model shown as Free in the [catalog](https://bigmodel.io/models).

## Related

- [OpenRouter compatibility](https://bigmodel.io/docs/openrouter-compat) for every supported field.
- [OpenAI SDK and LangChain](https://bigmodel.io/docs/openai-sdk-langchain)
- [Billing](https://bigmodel.io/docs/billing) for how USD balance and prices work.
- [Claude Code](https://bigmodel.io/docs/claude-code), [Cursor](https://bigmodel.io/docs/cursor) and other coding tool guides.
