@d-ai/pi

Pi extension for D.AI image, video, and music generation

Packages

Package details

extensionskill

Install @d-ai/pi from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@d-ai/pi
Package
@d-ai/pi
Version
0.2.11
Published
Nov 3, 2026
Downloads
835/mo · 73/wk
Author
liangdiandian
License
MIT
Types
extension, skill
Size
151.6 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "skills": [
    "./skills"
  ],
  "extensions": [
    "./dist/index.js"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@d-ai/pi

Pi package that adds D.AI image, video, and music generation as native tools.

Install

pi install npm:@d-ai/pi

From this repo:

cd sdks/pi && npm install && npm run build
pi install ./sdks/pi

Set a D.AI API key:

export DAI_API_KEY=ddsk_...

Or in Pi run /login, choose D.AI, and paste ddsk_.... Chat models come from the public capability catalog; GET /v1/models then drops ids this key cannot use. Claude models call Anthropic Messages at the gateway origin (POST /v1/messages). Each Claude model also lists @300k and @1m; Opus 4.8 and Opus 5 add :fast and :slow on those rows. :fast is billed at 2×, and the request still uses the base model id. Pi's $ total sums each reply from these per-million rates: input, output, cache read at 0.1× input, and 5-minute cache write at 1.25× input. :fast doubles that total; a 1-hour cache write is 2× input. The unsuffixed id stays the full catalog window at standard speed. Media models come from the same catalog. Then pick dai/<model> in /model. GPT-5.6 / GPT-6 and Claude expose thinking levels; gpt-6-astra cannot turn thinking off. Claude Opus 4.7+ and Fable use adaptive effort (xhigh / max).

/dai key also writes ~/.pi/agent/dai.json. Optional baseUrl defaults to https://dai.itbug.shop.

Reload Pi (/reload) after install.

Tools

Tool Default model
dai_generate_image gpt-image-2.5-flare
dai_generate_video veo-3.1-quality
dai_generate_music chirp-v5-5

Ask Pi to generate media, or pass a public model id (gpt-image-2.5-sunburst, gemini-3-pro-image-preview, flux-2-max, omni-flash).

gpt-image-2.5 is GPT Image 2.5(经济·非官方): explicitly select it for the lower-cost unofficial async channel. Pi submits and polls the job before returning the image. It generates one image only (count omitted or 1); size, quality, aspectRatio, outputFormat, and background are unsupported and rejected. Latency, reliability, and output may differ from the official channel. The default remains official gpt-image-2.5-flare; neither flare nor sunburst is automatically replaced with economy.

/dai prints status. /skill:dai-media loads the routing skill.

Footer balance

The footer shows the wallet behind the configured key as D.AI $86.95, read from GET /api/ai/account (the same numbers as the web console). It refreshes on session start and after each agent run, at most once every 15 seconds; /dai also reports the balance. A rejected key shows D.AI key invalid, while network failures keep the last good value.

The value is published through ctx.ui.setStatus("dai-balance", …), so it appears in Pi's built-in footer status row and in footer extensions that render extension statuses. A custom footer that replaces Pi's footer entirely still receives the status through footerData.getExtensionStatuses(); if it hides unknown keys, add dai-balance to its allow-list. Print mode (-p) has no footer, so no request is made.

Spend is billed to the D.AI wallet. This package does not wrap Midjourney buttons, Novel, HappyHorse, or ASR.

Release

Bump version in package.json (npm skips a version that is already published), commit, then from sdks/pi run npm publish --access public. Push the same commit to github-private master. The old GitHub Actions workflow was removed because Gitea also runs files under .github/workflows/.

After install, users need pi update npm:@d-ai/pi — plain pi install does not replace.