Base URL: https://www.myai168.com/en/api/openrouter/v1 (each endpoint URL = base URL + endpoint path; for the authentication, streaming, billing headers and error codes shared by all relays, see API Quick Start).
OpenRouter is an LLM gateway. One key gives access to hundreds of models (OpenAI / Anthropic / Google / Meta / Mistral, etc.) using vendor/model naming. Model ids differ from each vendor's own naming (Anthropic's claude-sonnet-5-5 is anthropic/claude-sonnet-5.5 on OpenRouter, for example), so use the id values returned by GET /models below. The key is your developer key from this site, not an OpenRouter key.
| Endpoint (appended to the base URL) | Purpose |
|---|---|
POST /chat/completions | Text conversation (Chat Completions format) with the chat models available on OpenRouter. |
POST /chat/responses | Same as above (requests and responses are also in Chat Completions format — not the OpenAI Responses API). |
POST /audio/speech | Text-to-speech (including ElevenLabs voices). |
POST /audio/transcriptions | Speech-to-text (including ElevenLabs Scribe). |
POST /videos, GET /videos/{id}, GET /videos/{id}/content | Video generation (asynchronous): submit a job, check its status, download the result. |
GET /models, GET /videos/models | Model lists (free). |
POST https://www.myai168.com/en/api/openrouter/v1/chat/completionsChat Completions (OpenAI format compatible). model and messages are required; the reply text is in choices[0].message.content.
curl https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"anthropic/claude-sonnet-5.5","messages":[{"role":"user","content":"Hello"}]}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/chat/completions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"model": "anthropic/claude-sonnet-5.5", "messages": [{"role": "user", "content": "Hello"}]},
timeout=600,
)
r.raise_for_status()
print(r.json()["choices"][0]["message"]["content"])
print("cost:", r.headers.get("X-Cost-Points"), "remaining:", r.headers.get("X-Credits-Remaining"))
POST https://www.myai168.com/en/api/openrouter/v1/chat/responsesNote: this endpoint is NOT the OpenAI Responses API — the request and response are both in Chat Completions format (same fields as completions above). It behaves the same as completions: both endpoints pre-check your credit balance and return 402 without forwarding when credits run out. For the OpenAI Responses API schema use https://www.myai168.com/en/api/openai/v1/responses instead.
curl https://www.myai168.com/en/api/openrouter/v1/chat/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"openai/gpt-6.1-sol","messages":[{"role":"user","content":"Hello"}]}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/chat/responses",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"model": "openai/gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello"}]},
)
print(r.json())
POST https://www.myai168.com/en/api/openrouter/v1/audio/speechText-to-speech (forwarded by OpenRouter to the speech provider); returns binary audio. This relay accepts the OpenRouter speech models of its model list that are billed per input character (Fish Audio: per UTF-8 byte), for example the whole ElevenLabs family (see below), hexgrad/kokoro-82m, mistralai/voxtral-mini-tts-2603, x-ai/grok-voice-tts-1.0 and fish-audio/s2.1-pro; models billed by audio length (such as Gemini TTS and Seed Audio) are not accepted (use this site's Google relay for Gemini TTS). voice depends on the model (e.g. af_bella for kokoro) — see the model page on OpenRouter; response_format is mp3 or pcm (default pcm). GET /models lists the speech models too.
ElevenLabs speech models: every ElevenLabs text-to-speech model on OpenRouter is billed per input character and is accepted by this relay — elevenlabs/eleven-v4 (most expressive, 90+ languages, up to 10,000 characters per request), elevenlabs/eleven-v4-turbo (low-latency v4, 90+ languages), elevenlabs/eleven-v3 (emotionally rich, 70+ languages, up to 5,000 characters), elevenlabs/eleven-v3-conversational (v3 tuned for dialogue, 70+ languages, up to 5,000 characters), elevenlabs/eleven-multilingual-v2 (long-form narration such as voice-overs and audiobooks, 29 languages, up to 10,000 characters), elevenlabs/eleven-flash-v2.5 and elevenlabs/eleven-turbo-v2.5 (low latency, 32 languages, up to 40,000 characters), elevenlabs/eleven-flash-v2 and elevenlabs/eleven-turbo-v2 (English only, low latency, up to 30,000 characters). voice is an ElevenLabs voice name (shared by all of these models, 21 in total): george, sarah, adam, alice, bella, bill, brian, callum, charlie, chris, daniel, eric, harry, jessica, laura, liam, lily, matilda, river, roger, will. The v3 / v4 models accept inline audio tags in square brackets (for example [excited], [whispers], [laughs]) to control emotion and delivery; keep the input within each model's per-request character limit (longer requests are rejected upstream and not charged). See the ElevenLabs page on OpenRouter for model details.
curl https://www.myai168.com/en/api/openrouter/v1/audio/speech \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"hexgrad/kokoro-82m","input":"Hello","voice":"af_bella","response_format":"mp3"}' \
--output speech.mp3
import requests
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/audio/speech",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"model": "hexgrad/kokoro-82m", "input": "Hello", "voice": "af_bella", "response_format": "mp3"},
)
with open("speech.mp3", "wb") as f:
f.write(r.content)
ElevenLabs example (model elevenlabs/eleven-v3, voices george / sarah):
curl https://www.myai168.com/en/api/openrouter/v1/audio/speech \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"elevenlabs/eleven-v3","input":"[excited] Hello! Welcome to our store.","voice":"george","response_format":"mp3"}' \
--output speech_elevenlabs.mp3
import requests
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/audio/speech",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"model": "elevenlabs/eleven-v3", "input": "Hello! Welcome to our store.", "voice": "sarah", "response_format": "mp3"},
)
r.raise_for_status()
with open("speech_elevenlabs.mp3", "wb") as f:
f.write(r.content)
print("cost:", r.headers.get("X-Cost-Points"), "remaining:", r.headers.get("X-Credits-Remaining"))
POST https://www.myai168.com/en/api/openrouter/v1/audio/transcriptionsSpeech-to-text (multipart upload; the upstream limit for file is 25 MB). This relay accepts every speech-to-text model of its model list (GET /models), for example openai/whisper-1, openai/gpt-4o-transcribe, x-ai/grok-stt-2.0 and ElevenLabs Scribe: elevenlabs/scribe-v2 (90+ languages, with word-level timestamps, speaker diarization and audio-event tags) and elevenlabs/scribe-v2-medical (tuned for clinical and medical terminology). response_format is json (default) or verbose_json (adds language, duration and segments; add timestamp_granularities[]=word for word timestamps and diarize=true for speaker diarization — both require verbose_json); language takes an ISO-639-1 code (auto-detected when omitted). Points are charged by the actual usage of the audio; the X-Cost-Points response header shows the charge for the call.
curl https://www.myai168.com/en/api/openrouter/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-F file=@audio.mp3 \
-F model=openai/whisper-1
import requests
with open("audio.mp3", "rb") as f:
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/audio/transcriptions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": f},
data={"model": "openai/whisper-1"},
)
print(r.json())
ElevenLabs Scribe example (verbose_json with word timestamps and speaker diarization):
curl https://www.myai168.com/en/api/openrouter/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-F file=@meeting.mp3 \
-F model=elevenlabs/scribe-v2 \
-F response_format=verbose_json \
-F "timestamp_granularities[]=word" \
-F diarize=true
import requests
with open("meeting.mp3", "rb") as f:
r = requests.post(
"https://www.myai168.com/en/api/openrouter/v1/audio/transcriptions",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": f},
data={"model": "elevenlabs/scribe-v2", "language": "en"},
)
r.raise_for_status()
print(r.json()["text"])
print("cost:", r.headers.get("X-Cost-Points"), "remaining:", r.headers.get("X-Credits-Remaining"))
POST https://www.myai168.com/en/api/openrouter/v1/videosVideo generation (an asynchronous job, matching the OpenRouter video API; the old path https://www.myai168.com/en/api/openrouter/v1/video/generations still works and behaves the same). The request returns 202 with the job right away; generation usually takes from tens of seconds to several minutes, so poll the polling_url until status is completed, then download the result. For the available models and each model's supported durations, resolutions and aspect ratios, call GET https://www.myai168.com/en/api/openrouter/v1/videos/models.
curl https://www.myai168.com/en/api/openrouter/v1/videos \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"google/veo-3.1","prompt":"A cat dancing","duration":8,"resolution":"720p","aspect_ratio":"16:9"}'
{"id": "gen-vid-1790000000-AbCdEf.123456", "polling_url": "https://www.myai168.com/en/api/openrouter/v1/videos/gen-vid-1790000000-AbCdEf.123456", "status": "pending"}
GET https://www.myai168.com/en/api/openrouter/v1/videos/{id}Check the job status (pending / in_progress / completed / failed / cancelled / expired). Use the id returned when you submitted (this site's job id, which differs from OpenRouter's own id); only the submitter's API keys can see the job. When completed, the response includes unsigned_urls (download URLs for the results).
GET https://www.myai168.com/en/api/openrouter/v1/videos/{id}/content?index=0Download a result (the API key is required here too); index selects which result (default 0).
import time
import requests
base = "https://www.myai168.com/en/api/openrouter/v1"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
job = requests.post(f"{base}/videos", headers=headers, json={
"model": "google/veo-3.1",
"prompt": "A cat dancing",
"duration": 8,
}).json()
while True:
time.sleep(30)
status = requests.get(job["polling_url"], headers=headers).json()
if status["status"] == "completed":
video = requests.get(status["unsigned_urls"][0], headers=headers)
with open("video.mp4", "wb") as f:
f.write(video.content)
break
if status["status"] in ("failed", "cancelled", "expired"):
print(status.get("error"))
break
Charges: credits are deducted by actual usage when the video completes (failed, cancelled or expired jobs are not charged); after completion, the poll response header X-Cost-Points shows the points charged for the job and X-Credits-Remaining your current balance. You need enough credits to submit, otherwise you get 402. callback_url (webhooks) is not supported — poll for the result; for previous_job_id (extending or editing an earlier video) pass the job id this site returned. Checking job status and downloading results are free.
GET https://www.myai168.com/en/api/openrouter/v1/modelsList the OpenRouter models this relay accepts — text, speech, speech-to-text and video models (from the official OpenRouter list, cached 10 minutes; query endpoint, free). A model that is not in this list is refused with 400 "No pricing info! Please use other models!". Each id is what to put in the model field; entries also include context_length and supported_parameters (the parameters that model supports). Video models are listed by GET /videos/models.
curl "https://www.myai168.com/en/api/openrouter/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"
curl "https://www.myai168.com/en/api/openrouter/v1/videos/models" \
-H "Authorization: Bearer YOUR_API_KEY"
The request format is the same as OpenAI Chat Completions, plus OpenRouter's own extension fields. Feature availability depends on the selected model (see supported_parameters from GET /models).
The system prompt is the first system message; for multi-turn conversations put the earlier turns in messages in order. The API keeps no conversation state, so send the full history every time.
curl https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"messages": [
{"role": "system", "content": "You are a concise assistant. Always answer in Traditional Chinese."},
{"role": "user", "content": "Recommend three books on time management."},
{"role": "assistant", "content": "1. Getting Things Done 2. Deep Work 3. Atomic Habits"},
{"role": "user", "content": "Which one is best for beginners?"}
]
}'
For models that accept images, make content an array and pass images as image_url (a public URL, or base64 in the form data:image/jpeg;base64,...).
curl https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-5.5",
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "What is in this image?"},
{"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
]
}]
}'
OpenRouter uses a unified reasoning field for every vendor's reasoning models: {"effort": "low" | "medium" | "high"}, or {"max_tokens": 4000} to cap thinking tokens; add "exclude": true to leave the reasoning out of the response. Returned reasoning text is in choices[0].message.reasoning.
curl https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-6.1-sol",
"reasoning": {"effort": "high"},
"messages": [{"role": "user", "content": "Prove that the square root of 2 is irrational."}]
}'
The models array lists fallback models: when the first cannot serve the request, the next one is used automatically (the model actually used is in the response model field). provider sets provider preferences, such as {"sort": "throughput"} (prefer faster output), {"sort": "latency"}, or {"order": ["anthropic"], "allow_fallbacks": false} to pin a provider.
curl https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"models": ["anthropic/claude-sonnet-5.5", "openai/gpt-6.1-sol"],
"provider": {"sort": "throughput"},
"messages": [{"role": "user", "content": "Hello"}]
}'
tools / tool_choice (function calling) and response_format ({"type": "json_schema", ...} structured output) are written exactly as in OpenAI Chat Completions — see the Chat Completions forms in "Common feature examples" on the OpenAI ChatGPT API page; support depends on the model.
Add "stream": true to receive the reply as SSE; use -N with curl. Text increments are in choices[0].delta.content, the last chunk carries usage, the stream ends with data: [DONE], and SSE comment lines then report the points charged and the remaining balance. While waiting for the model, OpenRouter sends keep-alive comment lines starting with : (such as : OPENROUTER PROCESSING); skip them when parsing.
curl -N https://www.myai168.com/en/api/openrouter/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"anthropic/claude-sonnet-5.5","stream":true,"messages":[{"role":"user","content":"Hello"}]}'
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"delta":{"content":"Hi"},"index":0}]}
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[{"delta":{},"finish_reason":"stop","index":0}]}
data: {"id":"gen-...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":8,"completion_tokens":12,"total_tokens":20}}
data: [DONE]
: cost=12
: credits-remaining=34567
Both endpoints take a Chat Completions format JSON body (chat/responses is not the OpenAI Responses API — it behaves the same as completions). Authenticate with an Authorization: Bearer YOUR_API_KEY header (never place keys in URL query strings).
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | required | OpenRouter model id in vendor/model form (e.g. anthropic/claude-sonnet-5.5). |
messages | array | required | Conversation messages (OpenAI Chat Completions format). role / content are forwarded as-is per the official format (including tool and other roles, and content-part arrays); support depends on the selected model. |
stream | boolean | optional | true streams the response as SSE. |
max_tokens | integer | optional | Upper limit on reply tokens. |
reasoning | object | optional | Reasoning settings: effort, max_tokens, exclude. |
models / provider | array / object | optional | Fallback models and provider routing (OpenRouter extension fields). |
tools / tool_choice / response_format | — | optional | Function calling and JSON output (OpenAI format). |
| Other official parameters | — | optional | temperature, top_p, stop, seed and so on are forwarded to OpenRouter as-is. |
OpenAI Chat Completions compatible: text in choices[0].message.content (streaming deltas in choices[0].delta.content). Each successful call is charged by usage; non-streaming responses carry X-Cost-Points (points charged) and X-Credits-Remaining (balance after the call) headers, and streaming responses append the same information after the stream ends as SSE comment lines : cost=N / : credits-remaining=M. You can also query your balance any time with GET https://www.myai168.com/en/api/user/get_credits.
The response usage carries token counts (prompt_tokens / completion_tokens / total_tokens); for the points charged, read the headers or comment lines above. choices[0].finish_reason is stop (normal end), length (token limit reached), tool_calls (a function call is requested) or content_filter.
| HTTP status | Meaning |
|---|---|
400 | Invalid request body (for example a missing model), or a model that is not in the relay's model list GET /models — including any entry of a models fallback list ("No pricing info! Please use other models!") / a speech model billed by audio length. A 400 returned by OpenRouter (such as an unknown model id) is also passed through unchanged. |
401 | Missing or invalid API key (repeated failures from the same IP are temporarily blocked), or this API key has reached its credit limit (API key credit limit reached!). |
402 | Insufficient credits (chat/responses / audio / video endpoints block before forwarding). |
404 | The video job id does not exist or was not submitted by this account. |
429 / 5xx | Rate limiting or overload reported by OpenRouter or its providers — the status code and error body are passed through unchanged; retry later or switch to another model. |
502 | Upstream vendor error — never charged. |
Error responses are JSON with the message in error.message, for example:
{"error": {"type": "invalid_request", "message": "Missing \"model\" field in request body."}}
No points are ever charged on errors, including a stream cut off midway. The relay waits up to about 10 minutes for the model; prefer streaming for long outputs.
The chat endpoints are OpenAI Chat Completions compatible, so the official OpenAI SDK works directly: set base_url (baseURL in Node.js) to https://www.myai168.com/en/api/openrouter/v1 and api_key to your developer key from this site, and call client.chat.completions (not client.responses).
from openai import OpenAI
client = OpenAI(
base_url="https://www.myai168.com/en/api/openrouter/v1",
api_key="YOUR_API_KEY",
)
chat = client.chat.completions.create(
model="anthropic/claude-sonnet-5.5",
messages=[{"role": "user", "content": "Hello"}],
)
print(chat.choices[0].message.content)
# Streaming
stream = client.chat.completions.create(
model="anthropic/claude-sonnet-5.5",
messages=[{"role": "user", "content": "Hello"}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
# OpenRouter-specific fields go through extra_body
chat = client.chat.completions.create(
model="openai/gpt-6.1-sol",
messages=[{"role": "user", "content": "Hello"}],
extra_body={"reasoning": {"effort": "high"}, "provider": {"sort": "throughput"}},
)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://www.myai168.com/en/api/openrouter/v1",
apiKey: "YOUR_API_KEY",
});
const chat = await client.chat.completions.create({
model: "anthropic/claude-sonnet-5.5",
messages: [{ role: "user", content: "Hello" }],
});
console.log(chat.choices[0].message.content);
OpenRouter's own extension fields (reasoning, provider, models) are not SDK parameters: in Python put them in extra_body; in Node.js add them to the same object. The SDK skips comment lines in the stream automatically.