What is the Mozg AI API
The Mozg AI API gives you direct access to the platform's models from your code, scripts and tools. Requests go to the model as is and come back as is: none of the chat add-ons — no persona, no knowledge base search, no skills, no automatic model selection. You choose the model yourself.
https://api.mozg.world/v1Base URL for the OpenAI SDK and curl.
Deducted from your plan's package, just like chat messages.
API keys aren't available on the free plan.
What's available now:
- OpenAI-compatible
POST /v1/chat/completions— with streaming, tool calling (function calling), structured output and image input. - Anthropic-compatible
POST /v1/messages— for Claude and Mozg Coder models. GET /v1/models— the models available on your plan.- Mozg Code — a coding agent for the terminal and for VS Code, Cursor and Windsurf, on the same subscription.
For a full description of request and response fields, see the API reference.
Your first request in a minute
Subscribe — the Start plan or higher. Plans and credit packages are on the home page; terms may change, and the current ones are always on the website.
Create a key. In the Mozg AI app, open your profile → “API keys” → “Create key”. The key is shown only once, so save it right away. Keys start with
mori_sk_.Store the key in an environment variable, not in your code:
export MOZG_API_KEY="mori_sk_…"
Find out which models are available to you and take the
idof the one you need:curl https://api.mozg.world/v1/models \ -H "Authorization: Bearer $MOZG_API_KEY"
Send a request:
curl https://api.mozg.world/v1/chat/completions \
-H "Authorization: Bearer $MOZG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4-pro",
"max_tokens": 512,
"messages": [
{"role": "user", "content": "Explain what recursion is in two sentences."}
]
}'
# pip install openai import os from openai import OpenAI client = OpenAI( base_url="https://api.mozg.world/v1", api_key=os.environ["MOZG_API_KEY"], ) resp = client.chat.completions.create( model="deepseek/deepseek-v4-pro", # any id from GET /v1/models max_tokens=512, messages=[{"role": "user", "content": "Explain what recursion is in two sentences."}], ) print(resp.choices[0].message.content)
// npm install openai import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.mozg.world/v1", apiKey: process.env.MOZG_API_KEY, }); const resp = await client.chat.completions.create({ model: "deepseek/deepseek-v4-pro", // any id from GET /v1/models max_tokens: 512, messages: [{ role: "user", content: "Explain what recursion is in two sentences." }], }); console.log(resp.choices[0].message.content);
max_tokens. Before a request, the platform reserves credits for the largest possible response and afterwards charges only the actual usage. Without max_tokens, the reservation is based on the model's ceiling — and the request may fail even if you have enough credits for a typical response. See “Credits and limits” for details.Authentication
Every API request carries the key in a header:
Authorization: Bearer mori_sk_…
For /v1/messages, the Anthropic header x-api-key: mori_sk_… also works. If both headers are sent with different keys, the request is rejected with a 401.
Keys in your profile
Keys are created and managed in the app: profile → “API keys”. A key is tied to your account and spends your subscription package. When creating a key, you can set:
| Setting | What it does |
|---|---|
| Name | Helps you tell keys apart. |
| Spend limit, credits | How many credits the key can spend per period: per day, per month or in total. Without a limit, a key can use up your entire package — it's best to set one for scripts and automation. |
| Requests per minute | Your own rate limit; can't exceed the platform limit. |
| Concurrent requests | Your own concurrency limit; can't exceed the platform limit. |
| Expiration | After how many days the key stops working. By default, keys never expire. |
The key list shows how many credits each key has spent, when it was last used and its status. You can rotate a key — the new secret keeps the same settings, and the old one keeps working for a set period so you have time to replace it in your software — or revoke it immediately.
A key created on the website gives access to chat models: /v1/chat/completions, /v1/messages and /v1/models.
Sign in with your account (OAuth)
Mozg AI apps — Mozg Code and the Chrome extension — don't ask for a key: they sign in with your Mozg AI account via OAuth 2.0 (PKCE, or device code sign-in in a terminal without a browser). You confirm the sign-in on app.mozg.world, and the app runs on your subscription. Connected apps are listed in your profile, and you can revoke access for any of them. For your own software and scripts, use an API key.
What you can call
The base URL is https://api.mozg.world/v1. Every response includes an X-Request-Id header — mention it to support if something goes wrong. There are no other paths: /v1/completions, /v1/responses, embeddings, and image and audio generation are not supported through /v1 and return 404.
POST/v1/chat/completions
The OpenAI Chat Completions format. The official OpenAI SDKs and compatible libraries work — just change base_url.
- Messages: roles
system,developer,user,assistant,tool; content is a string ortextandimage_urlblocks. - Parameters:
max_tokensormax_completion_tokens,temperature,top_p,stop(up to 4),seed,presence_penalty,frequency_penalty,response_format,stream,stream_options.include_usage. - Tools:
tools,tool_choice,parallel_tool_calls— for models that support tools (see the model table). - Reasoning depth:
reasoning_effort—none,low,medium,highormax; applies to models with a non-emptyeffortslist inGET /v1/models. - Images — inline data only:
data:image/png|jpeg|gif|webp;base64,…. Image URLs on the web are not downloaded and are rejected. - Not supported (returns 400 rather than being silently ignored):
ngreater than 1,functions/function_call,logprobs,top_logprobs,logit_bias,audio,modalities,prediction,web_search_options,best_of.
Streaming. With "stream": true, the response arrives as SSE events in OpenAI format and ends with data: [DONE]. If the model is thinking for a long time, the server sends : ping comments — these aren't response text, and SDKs skip them. The token usage frame (usage) is sent if you request it via stream_options.include_usage.
curl -N https://api.mozg.world/v1/chat/completions \
-H "Authorization: Bearer $MOZG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "z-ai/glm-5.3", "stream": true, "max_tokens": 512,
"messages": [{"role": "user", "content": "Three lines about the sea"}]}'
stream = client.chat.completions.create(
model="z-ai/glm-5.3",
max_tokens=512,
stream=True,
messages=[{"role": "user", "content": "Three lines about the sea"}],
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)
const stream = await client.chat.completions.create({ model: "z-ai/glm-5.3", max_tokens: 512, stream: true, messages: [{ role: "user", content: "Three lines about the sea" }], }); for await (const chunk of stream) { process.stdout.write(chunk.choices[0]?.delta?.content ?? ""); }
Tools. The model returns finish_reason: "tool_calls" and the call arguments; you run the function and send the result back in a second turn as a message with the tool role:
curl https://api.mozg.world/v1/chat/completions \
-H "Authorization: Bearer $MOZG_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "deepseek/deepseek-v4-pro", "max_tokens": 1024,
"messages": [{"role": "user", "content": "What is the weather in Berlin?"}],
"tools": [{"type": "function", "function": {
"name": "get_weather",
"parameters": {"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"]}}}],
"tool_choice": "auto"}'
# → choices[0].finish_reason = "tool_calls"
# → choices[0].message.tool_calls[0].function = {"name": "get_weather", "arguments": "{\"city\": \"Berlin\"}"}
# Second turn: add the assistant response with tool_calls to messages
# and {"role": "tool", "tool_call_id": "<id>", "content": "{\"t\": 12}"}POST/v1/messages
The Anthropic Messages format — for models whose supported_endpoints in GET /v1/models include messages: currently Claude and Mozg Coder models. Call all other models through /v1/chat/completions. The official Anthropic SDK works: specify base_url without /v1.
# pip install anthropic import os import anthropic client = anthropic.Anthropic( base_url="https://api.mozg.world", api_key=os.environ["MOZG_API_KEY"], ) msg = client.messages.create( model="anthropic/claude-sonnet-5.5", max_tokens=1024, messages=[{"role": "user", "content": "Hi! What can you do?"}], ) print(msg.content[0].text)
curl https://api.mozg.world/v1/messages \
-H "x-api-key: $MOZG_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model": "anthropic/claude-sonnet-5.5", "max_tokens": 1024,
"messages": [{"role": "user", "content": "Hi! What can you do?"}]}'
- Supported:
system,messageswithtext,image(source.type: base64only),tool_useandtool_resultblocks;toolsandtool_choice(auto,any,tool,none);temperature(0…1),top_p,top_k,stop_sequences(up to 16),stream; caching withcache_control: {"type": "ephemeral"}for 5 minutes. - Not supported (returns 400): images by URL and files,
documentblocks, Anthropic server tools (web_search,web_fetch,code_execution,bashand others),mcp_servers,container, one-hour cache (ttl: "1h"). - The
anthropic-versionandanthropic-betaheaders are accepted and have no effect.
GET/v1/models
The models available on your plan — the same ones as in the chat model picker. The response works with both the OpenAI SDK and the Anthropic SDK. Useful fields for each model:
| Field | What it means |
|---|---|
id | The model name for the request's model field, for example anthropic/claude-sonnet-5.5. |
name | A human-readable name. |
context_length, max_output_tokens | Context window and response ceiling in tokens. |
capabilities | tools — tool calling, vision — image input. |
supported_endpoints | chat.completions and, if available, messages. |
efforts, default_effort | Available reasoning_effort levels and the default level; an empty list means there are no levels. |
Model catalog
API models are the same as in the Mozg AI chat model picker. Which of them are available to you depends on your plan: GET /v1/models with your key always returns the exact list. The catalog grows and changes — below is its state at the time of publication.
| Model | id | Tools | Image input | /v1/messages |
|---|---|---|---|---|
| Mozg | ||||
| Mozg Black Fast | mori/black-fast | yes | yes | — |
| Mozg Black Standard | mori/black-standard | yes | yes | — |
| Mozg Black Maximum | mori/black-maximum | yes | — | — |
| Mozg Coder | mori/mozg-coder | yes | yes | yes |
| Anthropic | ||||
| Claude Fable 5.2 | anthropic/claude-fable-5.2 | yes | yes | yes |
| Claude Fable 5.1 | anthropic/claude-fable-5.1 | yes | yes | yes |
| Claude Opus 5.5 | anthropic/claude-opus-5.5 | yes | yes | yes |
| Claude Sonnet 5.5 | anthropic/claude-sonnet-5.5 | yes | yes | yes |
| Claude Sonnet 5 | anthropic/claude-sonnet-5 | yes | yes | yes |
| Claude Haiku 4.5 | anthropic/claude-haiku-4.5 | yes | yes | yes |
| OpenAI | ||||
| GPT-6 Astra | openai/gpt-6-astra | yes | — | — |
| GPT-6 Sol | openai/gpt-6-sol | yes | — | — |
| GPT-5.6 Terra | openai/gpt-5.6-terra | yes | — | — |
| GPT-6 Luna | openai/gpt-6-luna | yes | — | — |
| GPT-OSS 120B | openai/gpt-oss-120b | yes | — | — |
| Gemini 2.5 Pro | google/gemini-2.5-pro | yes | yes | — |
| Gemini 2.5 Flash | google/gemini-2.5-flash | yes | yes | — |
| Gemini 2.5 Flash-Lite | google/gemini-2.5-flash-lite | yes | yes | — |
| Gemma 4 31B | google/gemma-4-31b | yes | yes | — |
| Gemma 4 26B | google/gemma-4-26b | yes | yes | — |
| xAI | ||||
| Grok 4.6 | x-ai/grok-4.6 | yes | — | — |
| Moonshot AI | ||||
| Kimi K3.1 Pro | moonshotai/kimi-k3.1-pro | yes | — | — |
| Kimi K3 | moonshotai/kimi-k3 | yes | yes | — |
| Kimi K3 Fast | moonshotai/kimi-k3-fast | yes | yes | — |
| Kimi K2.7 | moonshotai/kimi-k2.7 | yes | yes | — |
| DeepSeek | ||||
| DeepSeek V4 Pro | deepseek/deepseek-v4-pro | yes | — | — |
| DeepSeek V4.1 Flash | deepseek/deepseek-v4.1-flash | yes | yes | — |
| Z.ai | ||||
| GLM-5.3 | z-ai/glm-5.3 | yes | — | — |
| GLM-5.3 Flash | z-ai/glm-5.3-flash | yes | yes | — |
| Alibaba | ||||
| Qwen 3.8 Max | qwen/qwen-3.8-max | yes | yes | — |
| Qwen 3.5 397B | qwen/qwen-3.5-397b | yes | yes | — |
| Qwen 3.6 35B | qwen/qwen-3.6-35b | yes | yes | — |
| Qwen 3.5 27B | qwen/qwen-3.5-27b | yes | yes | — |
| MiniMax | ||||
| MiniMax M3 | minimax/minimax-m3 | yes | yes | — |
| NVIDIA | ||||
| Nemotron 3 Ultra | nvidia/nemotron-3-ultra | yes | — | — |
| Meta | ||||
| Muse Spark Open | meta-llama/muse-spark-open | yes | — | — |
| Llama 3.3 70B* | meta-llama/llama-3.3-70b | — | — | — |
| Cohere | ||||
| Command A* | cohere/command-a | — | — | — |
* These models only respond without streaming: a request with "stream": true returns 400 with a hint to send "stream": false.
The API has no automatic model selection and no chat modes like “Fast”, “Standard” or “Maximum”: each request goes to exactly the model you named. An unknown model name returns 400 model_not_found; a model outside your plan returns 403 model_not_in_plan.
How credits are charged
The API runs on your subscription: each request is paid with credits from your plan's package — the same as chat messages. There's no separate API balance, top-ups or invoices. The cost of a request in credits depends on the model and the number of input and output tokens. Plans and package sizes are on the website; they may change.
Reservation. Before calling the model, the platform reserves credits for the maximum possible cost of the request — based on the input size and
max_tokens.Charged for actual usage. After the response, the actual token usage is charged and the rest of the reservation is returned to your package.
Not enough — nothing is charged. If your package or the key's limit doesn't have enough credits for the request's maximum cost, the API returns 402 before calling the model. Lower
max_tokensor top up your package in the app.
Limits
| Limit | Value |
|---|---|
| Requests per minute per key | 60 by default; you can set a lower value in the key settings. |
| Concurrent requests per key | 4 by default; you can set a lower value in the key settings. |
| Key spend limit | Set by you, in credits: per day, per month or all time. |
| Request body size | Up to 20 MB. |
| Stop sequences | Up to 4 in /v1/chat/completions, up to 16 in /v1/messages. |
The API has no daily message quotas — usage is limited by your subscription package and the key's spend limit.
Error codes
Errors come in OpenAI format (on /v1/messages — in Anthropic format):
{"error": {"message": "Invalid API key.", "type": "authentication_error", "code": "invalid_api_key", "param": null}}| HTTP | code | What happened and what to do |
|---|---|---|
| 400 | invalid_request, unsupported_parameter | The request body is malformed or a field isn't supported. param contains the field name. |
| 400 | model_not_found | The API has no such model. See GET /v1/models for the list. |
| 400 | tools_unsupported | The model doesn't support tools — remove tools or choose a different model. |
| 400 | context_length_exceeded | The request is longer than the model's context window. |
| 400 | invalid_effort | Invalid reasoning_effort value. |
| 401 | invalid_api_key | The key is missing, invalid, revoked or expired. |
| 402 | subscription_required | The account has no subscription — keys only work on a paid plan. Nothing was charged. |
| 402 | insufficient_package | Your package doesn't have enough credits for the request's maximum cost. Nothing was charged — lower max_tokens or top up your package. |
| 402 | key_spend_limit | The request doesn't fit within the key's remaining spend limit. Lower max_tokens or raise the limit in your profile. |
| 403 | model_not_in_plan | The model isn't included in your plan. |
| 403 | insufficient_scope | The key doesn't have access to this section. |
| 403 | service_blocked | Service access is blocked for this account — contact support. |
| 404 | not_found | The API has no such path. |
| 413 | request_too_large | The request body exceeds the allowed size. |
| 429 | rate_limited, concurrency_limited | The key's requests-per-minute or concurrent-requests limit was exceeded. Retry later, ideally with exponential backoff. |
| 429 | daily_cap, upstream_rate_limited | Temporary overload on the platform or the model provider. Retry later. |
| 502 | upstream_error, upstream_overloaded | The model provider didn't respond or is overloaded. |
| 503 | unavailable | The API is temporarily unavailable. Retry later. |
| 504 | upstream_timeout | The provider didn't respond in time. |
An error that occurs mid-stream arrives as a separate data: {"error": …} event.
Coding agent
Mozg Code reads your project, writes and edits code, runs commands and tests — and asks for permission before risky actions. It comes in two forms: Mozg CLI in the terminal (macOS, Linux, Windows) and an extension for VS Code, Cursor and Windsurf.
- No key needed. Sign in with your Mozg AI account:
mozg loginopens a browser at app.mozg.world, and on a server without a browsermozg login --deviceshows a code you can confirm from any device. - On your subscription. Models are those included in your plan; usage is deducted from your package just like in chat. Available from the Start plan.
- Beta: expect bugs; things will change.
curl -fsSL https://mozg.world/code/install.sh | bash
Images, video and audio
Mozg AI Studio generates and edits media in the browser: images, video, music and sound effects, voiceover, talking portraits and lip sync, 3D models, upscaling. Before running a job, Studio shows a cost estimate in credits; payment comes from your subscription package.
| Section | Models in the Studio catalog (examples) |
|---|---|
| Images | Nano Banana, GPT Image, FLUX, Seedream, Recraft, Ideogram, Qwen Image, Kling Image, Grok Imagine |
| Video | Kling, Seedance, Wan, MiniMax Hailuo, PixVerse, LTX, Luma Ray, Grok Imagine Video, Vidu |
| Audio | MiniMax Music, Stable Audio, ACE-Step, ElevenLabs Sound Effects, MiniMax Speech |
| Portraits and lip sync | OmniHuman, Kling Avatar, Sync Lipsync, Kling LipSync |
| 3D and enhancement | Tripo, Topaz Upscale |
The model lineup changes, and availability depends on your plan — the current list and estimates are shown in Studio itself.
Studio via API and MCP soon
Access to Studio from software and AI assistants is being prepared for launch and is currently disabled: keys created on the website only give access to chat models. Here's what's coming:
- REST: ordering generations with a job ID, a cost estimate before ordering, job polling and cancellation, and uploading your own reference files. Payment comes from your subscription package, as in the Studio interface, with the same key spend limit.
- An MCP server (Streamable HTTP) for Claude, Cursor and other MCP clients — with tools for generating images, video, audio and 3D, editing images, upscaling, cost estimates and job management. Connect with a key or by signing in with your account.
Once access opens, endpoints, examples and ready-made client configurations will appear here.
Frequently asked questions
01Will my OpenAI code work?
Yes, if it uses Chat Completions: change base_url to https://api.mozg.world/v1, the key to a Mozg AI key, and the model name to an id from GET /v1/models. The Responses API, embeddings, and image and audio generation are not supported at this address.
02Is the API available on the free plan?
No. Keys are available starting with the Start plan: the API runs on your subscription package credits. A request with a key from an account without a subscription returns 402 subscription_required, and nothing is charged.
03Why do I get 402 when I still have credits in my package?
Before a request, the maximum possible cost is reserved, based on the input and max_tokens. If max_tokens isn't set, the reservation is based on the model's output ceiling and may exceed your remaining package balance or the key's limit. Set a reasonable max_tokens: you'll still only be charged for actual usage.
04Where can I see my usage?
In your app profile: under “API keys”, each key shows how many credits it has spent. Your remaining package balance is in the same place as for chat.
05Can I call the API directly from the browser?
No: the API doesn't respond to requests from web pages (CORS is not enabled), which protects your key — any visitor could see it in the page code. Call the API from your own server.
06Does the API add anything to the model's response?
No. Messages are sent to the model as is, and the response is returned as is — only the model name in the model field changes. Personas, knowledge bases, skills and automatic model selection aren't available in the API — they're chat features.
07Where does my data go?
The request text is sent to the selected model's provider through Mozg AI servers. For details on data processing, see the Privacy Policy; terms of use are in the Terms of Service.
08Who do I contact if something doesn't work?
Contact support via the Telegram bot @aimorisupportbot. Include the X-Request-Id header value from the response: we'll use it to find your request. Never send anyone the key itself.











