Key in the keychain
macOS Keychain, or a 0600 file. Env vars need an explicit opt-in. Every byte of output goes through a redactor.
Open source · MIT · 0 runtime dependencies
Your AI agent creates images and video on KIE.ai — without ever seeing the API key, and never spending more than you allow.
$ npm i -g @uxdata-co/kie
╭─●─╮ ╱ ╲ ╱ ╱╲ ╲ ╱ ╱ ╲ ╲ ╲ ╱ ╱────╲ ╲ ╲ ╱ ╱ ╲ ╲ ●───╯ ╱ ╲ ╲ ╰───● kie v0.5.0 · media generation for AI agents images · video · zero deps · spend-guarded $ kie credits ╭─ ▲ kie credits ───────────────────────────────╮ │ balance 980 credits ≈ US$4.90 │ │ today 16 / 200 ████████████ 8% │ │ remaining today 184 credits │ ╰────────────────────────────────────────────────╯ $ kie image nano-banana-2 \ --prompt "isometric coffee shop" --aspect 16:9 ⠹ nano-banana-2 generating 40% task_c0ffee12 14s ╭─ ▲ kie generation complete ───────────────────╮ │ state success │ │ credits 8 │ │ files kie-media/nano-banana-2-c0ffee12.png │ ╰────────────────────────────────────────────────╯
Why kie
Media APIs are the most expensive credentials to leak. Most wrappers read the key from an env var, pull in hundreds of packages and ship a default webhook.
macOS Keychain, or a 0600 file. Env vars need an explicit opt-in. Every byte of output goes through a redactor.
Per-task cap, daily budget and balance check — all before the request leaves your machine.
Talks only to KIE's own hosts. No callbacks, no telemetry, no proxies.
JSON on stdout, exit codes you can branch on, and always file paths — never URLs that expire.
Install
Node ≥ 20. Published with npm provenance.
npm i -g @uxdata-co/kie
Input is hidden. It never appears in output again.
kie key set
Claude Code, Codex, Cursor and Gemini CLI.
kie skill install
Tutorials
Your coding agent makes the media, you keep the key.
New session — skills load from ~/.claude/skills/.
Ask in plain language, or invoke /kie-media.
$ kie credits --json$ kie image nano-banana-2 --prompt "isometric coffee shop, warm light" --aspect 16:9 --out ./assets --name hero-coffee --json
New session — skills load from ~/.agents/skills/.
Ask naturally, or call $kie-media. For video, say the cap out loud.
$ kie upload ./assets/hero-coffee.png --json$ kie video kling-3.0 --prompt "barista slides a cup across the counter, soft dolly-in" --image <url> --duration 5 --sound --max-credits 80 --json
Cursor 2.4+ — skills load from ~/.cursor/skills/.
Type / and pick kie-media, or just ask.
$ kie credits --json$ kie image nano-banana-2 --prompt "ceramic mug on linen, soft daylight" --aspect 1:1 --out ./public/shop --name mug-1 --json
Start gemini — /skills list shows kie-media.
Ask naturally; it calls activate_skill and asks consent once.
$ kie credits --json$ kie image nano-banana-2 --prompt "night market street, neon signs" --aspect 9:16 --resolution 2K --out ./assets/stories --name night-market --json
--max-credits.kie config set dailyBudget 300
Spend guard
Three independent checks run before any request leaves the machine. If one fails, you get exit code 3 and nothing was sent.
Models without a verified price require an explicit --max-credits — the agent has to say out loud what it accepts to spend.
A local ledger records every task and writes back the real credits spent. Pending tasks count at their cap.
If the estimate exceeds what's left on the account, the request never leaves.
$ kie video kling-3.0 --prompt "drone shot" ✖ Spend guard blocked the request: this model has no known credit estimate. Re-run with --max-credits <n> to state the most you accept to spend on this task. Today: 16 credits used, 184 remaining. $ echo $? 3
Documentation
Commands and flags, the model catalog, spend guard and exit codes, configuration, the agent skill and security notes.
FAQ
Yes. Without a Keychain the key is stored in ~/.config/kie/key with 0600 permissions. Everything else is identical.
Every release is published by GitHub Actions from a git tag, with npm provenance: the tarball is cryptographically linked to the commit that produced it. Zero runtime dependencies, so what you audit is what runs.
kie run <model-id> --input '{…}' --max-credits N sends any KIE Market model. Check the schema on docs.kie.ai first, or use --dry-run.
Of course. In a terminal it renders tables, panels and a live spinner; pipe it and you get JSON.
MIT licensed. Read the source before you trust it with a key — that's the point.
View on GitHub →