Skip to content

Guides

The OpenAI SDKs with MayuAI

There is no MayuAI SDK. The official OpenAI SDKs for Python and Node are the supported way to call MayuAI from code: give them the MayuAI base URL and your MayuAI key.

Set it up

You need a MayuAI API key: sign in and open Settings → API keys. The secret is shown once, when you create it.

  1. Install the SDK, and put your key in MAYUAI_API_KEY.

    pip install openai
    export MAYUAI_API_KEY="your key"
  2. Point the client at https://api.mayuai.com/v1, send one chat completion and list the models your key can call.

    import os
    from openai import OpenAI
    
    client = OpenAI(
        base_url="https://api.mayuai.com/v1",
        api_key=os.environ["MAYUAI_API_KEY"],
    )
    
    reply = client.chat.completions.create(
        model="gemini-3.5-flash-lite",
        messages=[{"role": "user", "content": "Hello"}],
    )
    print(reply.choices[0].message.content)
    
    for model in client.models.list():
        print(model.id)
  3. To receive the answer as it is written, add stream=True (Python) or stream: true (Node).

    import os
    from openai import OpenAI
    
    client = OpenAI(base_url="https://api.mayuai.com/v1", api_key=os.environ["MAYUAI_API_KEY"])
    
    stream = client.chat.completions.create(
        model="gemini-3.5-flash-lite",
        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)
    print()

Model ids

Use a model’s id exactly as it is written here. This is the catalog as it stands now, with the plans that include each model; the docs have each model’s credit rates.

Model ids you can use
IdModelPlans
claude-fable-5-1Claude Fable 5.1Developer and above
claude-fable-5-2Claude Fable 5.2Developer and above
claude-haiku-5-5Claude Haiku 5.5Starter and above
claude-opus-5-5Claude Opus 5.5Pro and above
claude-sonnet-5-5Claude Sonnet 5.5Pro and above
crouton-alphaCrouton AlphaAll plans
deepseek-flashDeepSeek V4.1 FlashStarter and above
deepseek-v4-proDeepSeek V4 Pro-0813Starter and above
fugu-ultra-v2Fugu Ultra v2Pro and above
gemini-3.1-pro-previewGemini 3.1 Pro PreviewPro and above
gemini-3.5-flash-liteGemini 3.5 Flash LiteAll plans
gemini-3.5-flashGemini 3.5 FlashStarter and above
gemini-3.6-flashGemini 3.6 FlashPro and above
gemini-3.7-flashGemini 3.7 FlashStarter and above
gemini-3.8-flashGemini 3.8 FlashStarter and above
gemini-4-argonGemini 4 ArgonPro and above
gemini-4-carbonGemini 4 CarbonDeveloper and above
gemini-4-hydrogenGemini 4 HydrogenStarter and above
gemini-4-neonGemini 4 NeonPro and above
glm-5.2GLM-5.2Starter and above
glm-5.3-flashxGLM-5.3 FlashXStarter and above
glm-5.3GLM-5.3Starter and above
gpt-5.6-solGPT-5.6 SolPro and above
gpt-6-astraGPT-6 AstraPro and above
gpt-6-lunaGPT-6 LunaStarter and above
gpt-6.1-solGPT-6.1 SolPro and above
gpt-6.1-terraGPT-6.1 TerraStarter and above
gpt-6.2-astraGPT-6.2 AstraPro and above
gpt-6.2-solGPT-6.2 SolPro and above
gpt-oss-120bGPT-OSS 120BAll plans
grok-4.5Grok 4.5Starter and above
grok-4.6Grok 4.6Starter and above
grok-4.7Grok 4.7Pro and above
kimi-k2.6Kimi K2.6Pro and above
kimi-k2.7-codeKimi K2.7 CodePro and above
kimi-k3.1-proKimi K3.1 ProPro and above
kimi-k3Kimi K3Pro and above
llama-4-maverickLlama 4 MaverickStarter and above
llama-4-scoutLlama 4 ScoutAll plans
mimo-v2.6-flashMiMo V2.6 FlashAll plans
mimo-v2.6-proMiMo V2.6 ProStarter and above
minimax-m3MiniMax M3Starter and above
mistral-large-4Mistral Large 4Starter and above
mistral-small-4Mistral Small 4Starter and above
muse-ember-1.0Muse Ember 1.0Starter and above
muse-spark-1.3-contributorMuse Spark 1.3 ContributorAll plans
muse-spark-1.3Muse Spark 1.3Starter and above
muse-wonderMuse WonderPro and above
nemotron-3.5-super-vlNemotron 3.5 Super VLStarter and above
qwen-3.7-flashQwen 3.7 FlashAll plans
qwen-3.7-maxQwen 3.7 MaxPro and above
qwen-3.8-flashQwen 3.8 FlashStarter and above
qwen-3.8-maxQwen 3.8 MaxPro and above
qwen-4-maxQwen 4 MaxPro and above

Good to know

  • Run with Python openai 3.61.0 and Node openai 7.66.0.
  • The reply's usage has OpenAI's token counts and MayuAI's own: usage.credits is what the request cost and usage.remaining your balance after it.
  • Errors arrive as the SDK's own: a bad key is an AuthenticationError (401), a model outside your plan a PermissionDeniedError (403), too many requests a RateLimitError (429). The reason is in the error's body.
  • Only client.chat.completions and client.models.list() are served. client.responses and client.completions are not, and tools is not supported (below).
  • Native tool calling is not supported: a request's tools are ignored and the answer is plain text, and a message with the tool role is refused (400). A feature that relies on native tool calls, such as an agent that edits files or runs commands that way, will not work through MayuAI.
  • Credits, plans and rate limits are the same as for any request. A tool that works in steps sends many requests in a row: see your plan’s AI requests a minute.

Every guide, and the API docs.

Common questions

Which parts of the OpenAI SDK work with MayuAI?

Chat completions, streamed or not, and the model list. The Responses API, the legacy completions call and native tool calling are not served.

How do I see what an SDK request cost?

The reply's usage has the token counts and two more fields: credits, what the request cost, and remaining, your balance after it.

Where to go next

  • Docs

    Every model with its rate, credits, plans and limits.

    Open
  • Models API

    The chat request and its reply.

    Open
  • Plans and credits

    Plans

    What each plan includes and which models it reaches.

    Open

Not open to the public yet

The official OpenAI SDKs for Python and Node, pointed at MayuAI with your MayuAI key.

Existing accounts can sign in. To ask about access, contact us.