Skip to content
Yoink

Use the Moonshot AI API in your coding agents

A key from the Moonshot AI platform reaches opencode, pi, Qwen Code, Crush, Droid, Claude Code and six more agents through the moonshot preset. Add it once with yoink add, pick Moonshot AI, then tick agents. yoink writes https://api.moonshot.ai/v1 for OpenAI-style agents and https://api.moonshot.ai/anthropic for Anthropic-style ones.

On this page

At a glance

Moonshot AI preset facts
FactValue
Preset idmoonshot
openai-chat endpointhttps://api.moonshot.ai/v1
anthropic-messages endpointhttps://api.moonshot.ai/anthropic
API keys pagehttps://platform.moonshot.ai/console/api-keys
Harnesses it reaches12 of 13
Add commandyoink add --external --name <name> --preset moonshot
Harnesses the Moonshot AI preset reaches
HarnessWith this preset
Claude Codeuses anthropic-messages
piuses openai-chat
ompuses openai-chat
opencodeuses openai-chat
codexnot offered: needs openai-responses
Qwen Codeuses openai-chat
Kilo Codeuses openai-chat
Droiduses anthropic-messages
Crushuses openai-chat
Gooseuses openai-chat
Zeduses openai-chat
Continueuses openai-chat
Claude Desktopuses anthropic-messages

Generated from the yoink CLI source and docs/providers.md (presets.ts).

moonshot or kimi-code?

Both presets serve Kimi models, but they are two separate accounts on two hosts:

Detailmoonshotkimi-code
Key pagehttps://platform.moonshot.ai/console/api-keyshttps://www.kimi.com/code
Chat Completionshttps://api.moonshot.ai/v1https://api.kimi.com/coding/v1
Anthropic Messageshttps://api.moonshot.ai/anthropichttps://api.kimi.com/coding

Each preset sends your key to its own host, so choose by the console that issued the key. If you hold both, add both: they are separate providers in yoink and can sit side by side in every agent except Claude Code, which takes one at a time. The Kimi Code page covers the other preset.

Add it

The interactive flow names the profile after the preset label, so it suggests moonshot-ai. That id becomes the provider key in every config and the stem of any environment variable an agent reads. The scripted example below uses the shorter moonshot.

yoink add
 
echo "$MOONSHOT_API_KEY" | yoink add --external --name moonshot --preset moonshot \
  --models <model> --connect opencode,qwen,droid,zed --default <model> --token-stdin

The picker reads the live list at https://api.moonshot.ai/v1/models. Model limits come from models.dev, where yoink prefers an entry filed under the provider key moonshot or served from api.moonshot.ai when the same model id appears under several providers.

What lands in Droid and Zed

Droid prefers Anthropic Messages, so its entries point at the /anthropic URL. Each model becomes one customModels item in ~/.factory/settings.json, tagged with the profile id in brackets so yoink can find it again:

{
  "model": "<model>",
  "displayName": "<model> [moonshot]",
  "baseUrl": "https://api.moonshot.ai/anthropic",
  "apiKey": "<your key>",
  "provider": "anthropic"
}

Zed (experimental) takes Chat Completions instead. yoink adds language_models.openai_compatible.moonshot with "api_url": "https://api.moonshot.ai/v1" and the model list, and sets agent.default_model. Zed never reads a key from settings.json, so after connecting yoink prints:

Zed does not store API keys in settings.json. Set MOONSHOT_API_KEY in your environment or paste the key in Zed's agent settings.

With the interactive id moonshot-ai, the variable is MOONSHOT_AI_API_KEY instead.

Use it in Claude Code

Claude Code gets ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic and the chosen model in every tier, and Moonshot AI becomes the active yoink profile. Use yoink connect moonshot --to claude-code --default <model>; the details of the seven keys and the per-project option are in Providers.

Rotate the key

Run yoink edit moonshot, choose API key, and paste the new one. Droid, opencode, Qwen Code and every other connected agent get it in the same save. Zed is the exception, and so is Goose when it keeps secrets in the OS keyring: there the key lives in your environment or the keyring, so update it there too.

FAQ

Can Moonshot AI and Kimi Code be connected to the same agent?

Yes, for every agent that holds several providers, such as opencode, pi or Crush. Each preset is its own provider entry with its own id. Claude Code is the exception: it runs one backend at a time.

Why does yoink suggest moonshot-ai as the profile id?

The suggestion is the preset label, Moonshot AI, turned into an id. You can type any id made of letters, digits, dots, dashes and underscores, and harness configs will use whatever you choose.

  • Use a Kimi Code API key in your coding agents

    The kimi-code preset points Claude Code at api.kimi.com/coding and opencode, pi or Crush at api.kimi.com/coding/v1. Distinct from switching Kimi logins.

  • Providers

    Add an API key once with yoink, from a preset (OpenAI, Kimi, OpenRouter, DeepSeek, z.ai, Ollama) or any compatible URL it probes, and pick its models.

  • Harnesses

    What yoink writes into pi, omp, opencode, codex, Claude Code, Qwen Code, Kilo, Droid, Crush, Continue, Goose, Zed and Claude Desktop: paths and keys.

  • Use an OpenAI API key in your coding agents

    The openai preset has a Responses endpoint, so it is the one preset that reaches Codex. yoink writes it to 11 agents; Claude Code needs Anthropic Messages.

  • Use OpenRouter in your coding agents

    Add your OpenRouter key once and yoink writes it into Claude Code, opencode, pi, Qwen Code, Crush and 7 more. Codex is not supported: no Responses endpoint.