Magpie
D.AI (dai.itbug.shop) models in magpie and OpenCode: one ddsk_ API key, chat models from the public catalog, per-key usage
0
0
20.0
生态多维模型
5 天前
2026-10-16
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@d-ai/magpie@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@d-ai/magpie@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @d-ai/magpieOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Use your D.AI models — GPT-6, Claude Opus 5.5, Grok 4.7, DeepSeek V4.1, GLM 5.3, Gemini 3.8 — from any agent that speaks through magpie or OpenCode.
One ddsk_… API key is one account, and magpie keeps several.
Add it
magpie plugin add mdddj/d-ai-magpie # from GitHub (the unofficial list installs this)
magpie plugin add @d-ai/magpie # from npm, once published
magpie plugin login dai # asks for the API key
magpie provider test dai # one tiny call per API
Then pick a model anywhere magpie does: dai/claude-opus-5-5,
dai/gpt-6-astra, dai/deepseek-v4.1-flash, …
The key comes from the D.AI console (/#/apikeys). Custom deployments can point
at another host with magpie plugin options dai '{"baseUrl":"https://dai.example"}'
or DAI_BASE_URL.
DAI_API_KEY=ddsk_… ./e2e.sh runs the same checks in a throwaway HOME, so it
never touches the magpie you actually use. Add --live to make one real call
on each API.
What it exposes
15 token-metered chat models, in two APIs:
| API | Models | Path |
|---|---|---|
| OpenAI chat completions | deepseek-v4.1-flash, gemini-3.8-flash, glm-5.3-flash, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-6-sol, grok-4.6, grok-4.7 |
/v1/chat/completions |
| Anthropic Messages | claude-fable-5, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-opus-5-5 |
/v1/messages |
The model list and the prices come from D.AI's public catalog on every start
(GET /api/system/public/capability-docs), narrowed to the models that key may
call (GET /v1/models), so a model you are not entitled to never shows up and a
new model appears without a plugin update. A built-in list is used when D.AI
cannot be reached while the provider is first configured.
Every model reports its context window, its output cap, its USD/1M-token prices and its thinking levels. Image input is marked for the families D.AI serves with vision (GPT-5/6, Claude, Gemini, Grok, DeepSeek, GLM).
Usage
magpie quota shows the account behind the key: the wallet balance, the tier
and its cycle, how much of the balance this key alone may spend, and how many
calls it made today. That comes from GET /api/ai/account, an endpoint
authenticated by the ddsk_ key itself.
A D.AI key has no plan window — it spends the account's shared wallet — so the card reads as a balance, not a quota window. Two keys of one account show the same balance but their own reservations and call counts.
Notes
- Only chat models. D.AI's image, video, music and ASR models are separate capabilities with their own endpoints; agents here want a chat completion.
- The usage card needs
GET /api/ai/accounton the D.AI deployment. Against an older one (404) the plugin falls back to the key's call log and shows call counts instead of a balance. - The plugin never rewrites request bodies. Thinking levels are offered as
model variants, and the gateway passes
reasoning_effortthrough. - Requests go out with
Authorization: Bearer <key>plusx-api-key, so either D.AI route works.
同类生态推荐
Magpie Tokener
@tokener-ai/magpie-plugin-tokener
Tokener.ai provider plugin for OpenCode and magpie: API key sign-in, model discovery, Chat and Messages
Opendesign Auth
opencode-opendesign-auth
OpenCode provider plugin: Open Design Cloud (Design Plan, Vela/AMR)
Notion Auth
opencode-notion-auth
Notion AI in magpie and OpenCode: the account's own models, with tool calls emulated through a planner envelope