Skip to content

Guides

OpenCode with MayuAI

OpenCode adds MayuAI as a custom provider in its config file, through its OpenAI-compatible provider package.

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. Add MayuAI to opencode.json in your project (or in ~/.config/opencode/opencode.json for every project), one entry under models per id you want:

    opencode.json
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "mayuai": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "MayuAI",
          "options": {
            "baseURL": "https://api.mayuai.com/v1",
            "apiKey": "{env:MAYUAI_API_KEY}"
          },
          "models": {
            "gemini-3.5-flash-lite": {}
          }
        }
      }
    }
  2. Put your key in MAYUAI_API_KEY, where the config reads it, then start OpenCode.

    Shell
    export MAYUAI_API_KEY="your key"
    opencode
  3. Run /models and choose MayuAI's gemini-3.5-flash-lite.

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

  • 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.
  • MayuAI serves POST /v1/chat/completions (streamed or not) and GET /v1/models, and no other OpenAI route.
  • A tool's model list comes from GET /v1/models. If a model your plan includes is not in it, type its id by hand.
  • 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.

The setting names on this page are OpenCode’s own and can change between its versions. MayuAI has checked the API this setup calls (chat completions, streamed and not, and the model list), not OpenCode itself.

Every guide, and the API docs.

Common questions

How does OpenCode reach MayuAI?

Through a custom provider in opencode.json that uses OpenCode's OpenAI-compatible provider package, with the MayuAI base URL and your key.

Where does OpenCode read the MayuAI key from?

From the environment variable the config names, MAYUAI_API_KEY in the guide, so the key is not written in the file.

Where to go next

  • Every guide

    The OpenAI SDKs and the other coding tools.

    Open
  • Docs

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

    Open
  • Plans and credits

    Plans

    What each plan includes and which models it reaches.

    Open

Not open to the public yet

MayuAI as a custom provider in OpenCode's config file, with your key read from the environment.

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