Docs · Providers
Meituan LongCat in Claude Code and Codex
LongCat is Meituan's model platform, serving its own LongCat models at api.longcat.chat. Accounts from longcat.chat and longcat.ai share that host: Chat Completions and Responses under /openai/v1, Anthropic Messages under /anthropic. Add LongCat in magpie, and Claude Code's, Codex's, Gemini CLI's and OpenCode's requests go as they are, with magpie's local gateway on 127.0.0.1:3425 routing them and holding the key.
Add LongCat
- Add the providerOn Providers, click + Add provider, pick LongCat, paste the key and save.
- Pick it for a toolOn Agents, pick a model such as LongCat-2.0 on a tool's row.
Keys are made at longcat.chat/platform/api_keys.
magpie claude longcat/LongCat-2.0 magpie codex longcat/LongCat-2.0 magpie opencode longcat/LongCat-2.5-Preview
Endpoints
| API | Endpoint |
|---|---|
| Chat Completions | https://api.longcat.chat/openai/v1 |
| Responses | https://api.longcat.chat/openai/v1 |
| Anthropic Messages | https://api.longcat.chat/anthropic |
| /models | https://api.longcat.chat/openai/v1/models |
Both take the key as Authorization: Bearer; with x-api-key alone LongCat answers missing_api_key, and magpie's Anthropic requests carry the key in both x-api-key and a Bearer by default, so they pass. An entry another app has at these endpoints is imported as LongCat.
Models
magpie gives LongCat-2.0 and LongCat-2.5-Preview, then reads LongCat's list from /openai/v1/models and serves that. Model names are case-sensitive; write them as the list does.
In each agent
- Claude Code speaks Anthropic Messages. LongCat has an Anthropic endpoint, so requests go as they are. See Claude Code with other models.
- Codex speaks only OpenAI Responses. LongCat serves Responses, so Codex's requests go as they are. The models show in Codex's
/model. See Codex with other models. - Gemini CLI speaks Gemini's API; magpie points it at the local gateway and translates. See Gemini CLI with other models.
- OpenCode: magpie writes the models into opencode.json. See OpenCode with other models.
FAQ
How do I use LongCat in Claude Code?
Add LongCat in magpie with your longcat.chat platform key, then pick LongCat-2.0 on Claude Code's row, or run magpie claude longcat/LongCat-2.0. Requests go to https://api.longcat.chat/anthropic.
Does LongCat work in Codex?
Yes. LongCat serves Responses under /openai/v1, so magpie passes Codex's requests through. Run magpie codex longcat/LongCat-2.0.
Why does Claude Code get missing_api_key from LongCat directly?
LongCat takes the key only as Authorization: Bearer and refuses x-api-key alone. Through magpie, the key goes in both x-api-key and a Bearer by default.
Does a longcat.ai account work?
Yes. longcat.chat and longcat.ai accounts share api.longcat.chat; add LongCat in magpie for either.
The same for other providers: StepFun, Xiaomi MiMo, DeepSeek, GLM Coding Plan, Kimi, DeepSeek, Qwen. Hit an error? See troubleshooting, or ask on Discord.