DOCUMENTATION

Mozg AI for developers

Use Mozg AI models in your own software through an API compatible with OpenAI and Anthropic. Your key runs on your subscription: requests are paid with package credits, just like chat messages, with no separate wallet and no bills from providers.

API · /v1

Models via API

Chat Completions in OpenAI format and Messages in Anthropic format: streaming, tools, image input.

Endpoints →
Catalog

Models

Claude, GPT, Gemini, Grok, Kimi, DeepSeek, GLM, Qwen and Mozg models — the same ones your plan unlocks in chat.

Model list →
Terminal · editor

Mozg Code

A coding agent for the terminal and VS Code. Signs in with your Mozg AI account — no key needed.

Learn more →
Images · video · audio

Studio and MCP

Generate media in Studio on the website. Studio access via API and MCP is coming soon.

Studio →
01 — OVERVIEW

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.

Base URL
https://api.mozg.world/v1

Base URL for the OpenAI SDK and curl.

Billing
Subscription credits

Deducted from your plan's package, just like chat messages.

Access
From the Start plan

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.

02 — QUICKSTART

Your first request in a minute

  1. 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.

  2. 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_.

  3. Store the key in an environment variable, not in your code:

    bash
    export MOZG_API_KEY="mori_sk_…"
  4. Find out which models are available to you and take the id of the one you need:

    curl
    curl https://api.mozg.world/v1/models \
      -H "Authorization: Bearer $MOZG_API_KEY"
  5. 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."}
    ]
  }'
Always set 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.
03 — KEYS AND SIGN-IN

Authentication

Every API request carries the key in a header:

http
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:

SettingWhat it does
NameHelps you tell keys apart.
Spend limit, creditsHow 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 minuteYour own rate limit; can't exceed the platform limit.
Concurrent requestsYour own concurrency limit; can't exceed the platform limit.
ExpirationAfter 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.

Treat your key like a password. Anyone who knows the key can spend your package. Don't publish it in repositories or put it in web page or mobile app code: the API doesn't respond to browser requests (CORS is not enabled) — call it from your own server. If a key leaks, revoke it in your profile right away.

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.

04 — ENDPOINTS

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 or text and image_url blocks.
  • Parameters: max_tokens or max_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, high or max; applies to models with a non-empty efforts list in GET /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): n greater 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"}]}'

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
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)
  • Supported: system, messages with text, image (source.type: base64 only), tool_use and tool_result blocks; tools and tool_choice (auto, any, tool, none); temperature (0…1), top_p, top_k, stop_sequences (up to 16), stream; caching with cache_control: {"type": "ephemeral"} for 5 minutes.
  • Not supported (returns 400): images by URL and files, document blocks, Anthropic server tools (web_search, web_fetch, code_execution, bash and others), mcp_servers, container, one-hour cache (ttl: "1h").
  • The anthropic-version and anthropic-beta headers 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:

FieldWhat it means
idThe model name for the request's model field, for example anthropic/claude-sonnet-5.5.
nameA human-readable name.
context_length, max_output_tokensContext window and response ceiling in tokens.
capabilitiestools — tool calling, vision — image input.
supported_endpointschat.completions and, if available, messages.
efforts, default_effortAvailable reasoning_effort levels and the default level; an empty list means there are no levels.
05 — MODELS

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.

ModelidToolsImage input/v1/messages
Mozg
Mozg Black Fastmori/black-fastyesyes—
Mozg Black Standardmori/black-standardyesyes—
Mozg Black Maximummori/black-maximumyes——
Mozg Codermori/mozg-coderyesyesyes
Anthropic
Claude Fable 5.2anthropic/claude-fable-5.2yesyesyes
Claude Fable 5.1anthropic/claude-fable-5.1yesyesyes
Claude Opus 5.5anthropic/claude-opus-5.5yesyesyes
Claude Sonnet 5.5anthropic/claude-sonnet-5.5yesyesyes
Claude Sonnet 5anthropic/claude-sonnet-5yesyesyes
Claude Haiku 4.5anthropic/claude-haiku-4.5yesyesyes
OpenAI
GPT-6 Astraopenai/gpt-6-astrayes——
GPT-6 Solopenai/gpt-6-solyes——
GPT-5.6 Terraopenai/gpt-5.6-terrayes——
GPT-6 Lunaopenai/gpt-6-lunayes——
GPT-OSS 120Bopenai/gpt-oss-120byes——
Google
Gemini 2.5 Progoogle/gemini-2.5-proyesyes—
Gemini 2.5 Flashgoogle/gemini-2.5-flashyesyes—
Gemini 2.5 Flash-Litegoogle/gemini-2.5-flash-liteyesyes—
Gemma 4 31Bgoogle/gemma-4-31byesyes—
Gemma 4 26Bgoogle/gemma-4-26byesyes—
xAI
Grok 4.6x-ai/grok-4.6yes——
Moonshot AI
Kimi K3.1 Promoonshotai/kimi-k3.1-proyes——
Kimi K3moonshotai/kimi-k3yesyes—
Kimi K3 Fastmoonshotai/kimi-k3-fastyesyes—
Kimi K2.7moonshotai/kimi-k2.7yesyes—
DeepSeek
DeepSeek V4 Prodeepseek/deepseek-v4-proyes——
DeepSeek V4.1 Flashdeepseek/deepseek-v4.1-flashyesyes—
Z.ai
GLM-5.3z-ai/glm-5.3yes——
GLM-5.3 Flashz-ai/glm-5.3-flashyesyes—
Alibaba
Qwen 3.8 Maxqwen/qwen-3.8-maxyesyes—
Qwen 3.5 397Bqwen/qwen-3.5-397byesyes—
Qwen 3.6 35Bqwen/qwen-3.6-35byesyes—
Qwen 3.5 27Bqwen/qwen-3.5-27byesyes—
MiniMax
MiniMax M3minimax/minimax-m3yesyes—
NVIDIA
Nemotron 3 Ultranvidia/nemotron-3-ultrayes——
Meta
Muse Spark Openmeta-llama/muse-spark-openyes——
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.

06 — CREDITS AND LIMITS

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.

  1. 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.

  2. Charged for actual usage. After the response, the actual token usage is charged and the rest of the reservation is returned to your package.

  3. 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_tokens or top up your package in the app.

If the client cuts off a streaming response, the model still finishes generating it, and usage is charged for what was actually generated: the provider charges for generated tokens, not for the ones that reached you.

Limits

LimitValue
Requests per minute per key60 by default; you can set a lower value in the key settings.
Concurrent requests per key4 by default; you can set a lower value in the key settings.
Key spend limitSet by you, in credits: per day, per month or all time.
Request body sizeUp to 20 MB.
Stop sequencesUp 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.

07 — ERRORS

Error codes

Errors come in OpenAI format (on /v1/messages — in Anthropic format):

json
{"error": {"message": "Invalid API key.", "type": "authentication_error", "code": "invalid_api_key", "param": null}}
HTTPcodeWhat happened and what to do
400invalid_request, unsupported_parameterThe request body is malformed or a field isn't supported. param contains the field name.
400model_not_foundThe API has no such model. See GET /v1/models for the list.
400tools_unsupportedThe model doesn't support tools — remove tools or choose a different model.
400context_length_exceededThe request is longer than the model's context window.
400invalid_effortInvalid reasoning_effort value.
401invalid_api_keyThe key is missing, invalid, revoked or expired.
402subscription_requiredThe account has no subscription — keys only work on a paid plan. Nothing was charged.
402insufficient_packageYour package doesn't have enough credits for the request's maximum cost. Nothing was charged — lower max_tokens or top up your package.
402key_spend_limitThe request doesn't fit within the key's remaining spend limit. Lower max_tokens or raise the limit in your profile.
403model_not_in_planThe model isn't included in your plan.
403insufficient_scopeThe key doesn't have access to this section.
403service_blockedService access is blocked for this account — contact support.
404not_foundThe API has no such path.
413request_too_largeThe request body exceeds the allowed size.
429rate_limited, concurrency_limitedThe key's requests-per-minute or concurrent-requests limit was exceeded. Retry later, ideally with exponential backoff.
429daily_cap, upstream_rate_limitedTemporary overload on the platform or the model provider. Retry later.
502upstream_error, upstream_overloadedThe model provider didn't respond or is overloaded.
503unavailableThe API is temporarily unavailable. Retry later.
504upstream_timeoutThe provider didn't respond in time.

An error that occurs mid-stream arrives as a separate data: {"error": …} event.

08 — MOZG CODE

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 login opens a browser at app.mozg.world, and on a server without a browser mozg login --device shows 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.
macOS · Linux
curl -fsSL https://mozg.world/code/install.sh | bash

Installation and guide →

09 — STUDIO AND MCP

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.

SectionModels in the Studio catalog (examples)
ImagesNano Banana, GPT Image, FLUX, Seedream, Recraft, Ideogram, Qwen Image, Kling Image, Grok Imagine
VideoKling, Seedance, Wan, MiniMax Hailuo, PixVerse, LTX, Luma Ray, Grok Imagine Video, Vidu
AudioMiniMax Music, Stable Audio, ACE-Step, ElevenLabs Sound Effects, MiniMax Speech
Portraits and lip syncOmniHuman, Kling Avatar, Sync Lipsync, Kling LipSync
3D and enhancementTripo, 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.

10 — FAQ

Frequently asked questions

01

Will 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.

02

Is 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.

03

Why 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.

04

Where 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.

05

Can 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.

06

Does 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.

07

Where 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.

08

Who 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.