Short answer
Switching from OpenRouter to APIVAI means changing three things: the base URL (https://api.apivai.com/v1 for OpenAI-format clients, https://api.apivai.com for Anthropic-format clients such as Claude Code), the API key, and the model IDs (anthropic/claude-sonnet-4.6 becomes claude-sonnet-4-6). It makes sense if most of your traffic goes to Claude or GPT models: as of 2026-10-10, APIVAI prices most Claude models 56–62% below list and GPT up to 86% below list.
For a full side-by-side comparison, see OpenRouter vs APIVAI.
| Model | List price (input / output, per 1M) | APIVAI (input / output, per 1M) |
|---|---|---|
| Claude Sonnet 4.6 | $3.00 / $15.00 | $1.15 / $5.74 |
| Claude Opus 5.5 | $4.00 / $20.00 | $1.54 / $7.65 |
| GPT-5.5 | $5.00 / $30.00 | $0.77 / $4.56 |
APIVAI prices as of 2026-10-10; the pricing page has every model. OpenRouter generally charges the provider's list price for these models; check OpenRouter's pricing for current terms.
Before you start
- Create an APIVAI account with your email and a verification code.
- Add balance. The minimum top-up is $10 by card or crypto, or ¥20 via Alipay / WeChat Pay.
- On the Dashboard, create an API key. You can give each key its own budget, which is useful if you want a separate key for the migration test.
How do OpenRouter model IDs map to APIVAI?
OpenRouter uses provider/model IDs with dots in version numbers. APIVAI uses the plain model ID with dashes for Claude. The OpenRouter column below shows the usual pattern; check the exact IDs on OpenRouter's models page, since they can differ.
| OpenRouter-style ID | APIVAI ID |
|---|---|
anthropic/claude-sonnet-4.6 | claude-sonnet-4-6 |
anthropic/claude-opus-4.6 | claude-opus-4-6 |
anthropic/claude-haiku-4.5 | claude-haiku-4-5 |
anthropic/claude-opus-5.5 | claude-opus-5-5 |
anthropic/claude-sonnet-5 | claude-sonnet-5 |
openai/gpt-5.5 | gpt-5.5 |
GPT IDs on APIVAI keep their dots (gpt-5.5, gpt-6.1-sol); only the openai/ prefix goes. To get the authoritative list from your own key, call GET /v1/models (shown in the testing section below).
Step 1: Environment variables
If your code reads the base URL and key from the environment, this is the whole change for OpenAI-format clients:
# Before (OpenRouter) export OPENAI_BASE_URL="https://openrouter.ai/api/v1" export OPENAI_API_KEY="sk-or-..." # After (APIVAI) export OPENAI_BASE_URL="https://api.apivai.com/v1" export OPENAI_API_KEY="your-apivai-key"
Then update the model ID wherever it is set (often a MODEL variable or a config file).
Step 2: OpenAI Python SDK
from openai import OpenAI
client = OpenAI(
base_url="https://api.apivai.com/v1",
api_key="your-apivai-key",
)
resp = client.chat.completions.create(
model="claude-sonnet-4-6", # was "anthropic/claude-sonnet-4.6"
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)Streaming (stream=True), tool calling and image inputs work the same way. If you passed extra_headers or extra_body for OpenRouter, remove them (see below).
Step 3: OpenAI Node SDK
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.apivai.com/v1",
apiKey: process.env.APIVAI_KEY,
});
const resp = await client.chat.completions.create({
model: "gpt-5.5", // was "openai/gpt-5.5"
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);The Responses API (client.responses.create) also works against the same base URL.
Step 4: LangChain and similar frameworks
Most frameworks wrap the OpenAI client and accept a base URL and key. In LangChain's ChatOpenAI this is usually:
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="claude-sonnet-4-6",
base_url="https://api.apivai.com/v1",
api_key="your-apivai-key",
)Parameter names differ between frameworks and versions (base_url, openai_api_base, baseURL), so check your library's docs. If you used a dedicated OpenRouter integration, replace it with the framework's generic OpenAI-compatible client.
Step 5: Cursor
In Cursor, open Settings > Models, enable Override OpenAI Base URL and set it to https://api.apivai.com/v1. Paste your APIVAI key as the OpenAI API key, then add the model IDs you want (for example claude-sonnet-4-6 or gpt-5.5) as custom models. The Cursor setup guide covers the details.
Step 6: Cline
In Cline's settings, choose the OpenAI Compatible provider, set the base URL to https://api.apivai.com/v1, paste your APIVAI key and enter a model ID such as claude-sonnet-4-6. Menu names change between versions, but these three fields are what matter. Continue and similar extensions follow the same pattern.
Step 7: Claude Code
Claude Code speaks the Anthropic Messages format, and APIVAI serves that format natively, so no translation layer is needed. Note the base URL has no /v1:
export ANTHROPIC_BASE_URL="https://api.apivai.com" export ANTHROPIC_AUTH_TOKEN="your-apivai-key" unset ANTHROPIC_API_KEY # if set, it takes priority and causes 401 errors
Start claude and switch models with /model. If you previously routed Claude Code through OpenRouter or a proxy, remove those settings. Full walkthrough: Claude Code setup guide.
What OpenRouter-specific settings should you remove?
- Provider routing options such as a
providerobject in the request body: APIVAI does not use these options. Remove them. - The
modelsfallback array and similar OpenRouter request fields: not supported. Send a singlemodel. HTTP-RefererandX-Titleheaders: used for OpenRouter's app attribution. They are simply not needed; you can delete them.- Model ID suffixes or auto-routing models: use a concrete APIVAI model ID instead.
If you relied on OpenRouter's automatic model fallback, move that logic into your own code. A minimal version:
for model in ["claude-sonnet-4-6", "gpt-5.5"]:
try:
resp = client.chat.completions.create(model=model, messages=messages)
break
except Exception as e:
print(f"{model} failed: {e}")How do you test the switch?
List the models your key can use:
curl https://api.apivai.com/v1/models \ -H "Authorization: Bearer your-apivai-key"
Send one chat completion:
curl https://api.apivai.com/v1/chat/completions \
-H "Authorization: Bearer your-apivai-key" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-4-6", "messages": [{"role": "user", "content": "Say OK"}]}'Then check the Dashboard: each request appears with its token counts and cost. Common errors: 401 means a wrong or out-of-budget key (or ANTHROPIC_API_KEY overriding in Claude Code); 404 usually means the base URL is wrong (the final address must be https://api.apivai.com/v1/chat/completions or https://api.apivai.com/v1/messages; most OpenAI-format clients take https://api.apivai.com/v1, Claude Code and the Anthropic SDK take https://api.apivai.com); 429 means more than 60 requests per minute on one key.
Can you run both side by side during migration?
Yes, and for production it is the safer path. Keep two clients and pick one by a config flag:
import os
from openai import OpenAI
if os.getenv("LLM_BACKEND") == "apivai":
client = OpenAI(base_url="https://api.apivai.com/v1", api_key=os.getenv("APIVAI_KEY"))
model = "claude-sonnet-4-6"
else:
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OPENROUTER_KEY"))
model = "anthropic/claude-sonnet-4.6"Move one service or a share of traffic first, compare output and cost for a few days, then switch the rest. The default limit is 60 requests per minute per key; if you need more for production traffic, ask support before the cutover.
What do you lose by leaving OpenRouter?
Model breadth. APIVAI offers Claude and GPT models only. If you use open-weight models, Gemini, Mistral or other families through OpenRouter, you will still need OpenRouter or another provider for those, and keeping both is a reasonable setup. APIVAI also does not offer Batch, Files, embeddings, image generation, audio or fine-tuning endpoints; the official OpenAI API and Anthropic API offer those.
What stays the same or improves for Claude and GPT traffic: one key for both the OpenAI and Anthropic formats, streaming and tool calling in both, and per-request costs on the Dashboard. APIVAI does not store or inspect request or response content; only usage metadata is kept for billing.
FAQ
Do I need to change my code, or just the config?
Usually only config: base URL, API key and model ID. Code changes are needed only if you used OpenRouter-specific request fields or headers, which you should remove.
Can I keep using the OpenAI SDK for Claude models?
Yes. Point the OpenAI SDK at https://api.apivai.com/v1 and use a Claude ID such as claude-sonnet-4-6. You can also use the Anthropic SDK with base URL https://api.apivai.com.
Does APIVAI support automatic model fallback?
No. Each request goes to the model you name. Implement fallback in your code by catching errors and retrying with another model ID.
Can I move my OpenRouter credits to APIVAI?
No, balances are separate. Use up or manage your OpenRouter credits under their terms, and top up APIVAI from $10 (card or crypto) or ¥20 (Alipay / WeChat Pay).
How do I pay for APIVAI?
By credit or debit card, cryptocurrency (USDT and more), Alipay or WeChat Pay. Billing is a prepaid balance with no subscription or monthly minimum.
Where can I compare the two services in more detail?
See OpenRouter vs APIVAI for the full comparison and the docs for every endpoint.