
Product
PHP and Composer Support Is Now in Beta
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.
ai-media-cli
Advanced tools
The easiest way to generate AI images, videos, music & speech from JavaScript/TypeScript — as a CLI, npx command, or library.
The easiest way to generate AI images, videos, music, and speech from JavaScript / TypeScript.
Use it as a CLI, via npx, or as a library in your own projects.
Powered by Kubeez — a simple, powerful API for AI media generation.
ai-media-cli login — no config files to create--wait flag to poll until generation completesAPIError, TimeoutError for clean error handling--json for scripting# No install needed — just use npx
npx ai-media-cli login YOUR_API_KEY
npx ai-media-cli generate -p "a cyberpunk cityscape at sunset" -m nano-banana-2 --wait
Get your API key at kubeez.com -> API Keys.
npm install -g ai-media-cli
# or
bun install -g ai-media-cli
Then use anywhere:
ai-media-cli generate -p "a beautiful mountain landscape" -m nano-banana-2 --wait
npm install ai-media-cli
# or
bun add ai-media-cli
import { AIImageClient } from "ai-media-cli";
const client = new AIImageClient({ apiKey: "your-key" });
const gen = await client.generateMedia({
prompt: "a serene Japanese garden in autumn",
model: "nano-banana-2",
});
const result = await client.pollForCompletion(gen.generation_id);
console.log(result.outputs?.[0]?.url);
ai-media-cli login YOUR_API_KEY
Saves to ~/.ai-image-cli/config.json with 600 permissions. One-time setup.
ai-media-cli whoami # show masked key + balance
ai-media-cli logout # remove saved key
export AI_IMAGE_API_KEY=your_api_key_here
Environment variable always takes priority over the config file.
| Command | Description |
|---|---|
ai-media-cli login <key> | Save API key to ~/.ai-image-cli |
ai-media-cli logout | Remove saved key |
ai-media-cli whoami | Show masked key and balance |
# List models with pricing table
ai-media-cli models
ai-media-cli models --type image
ai-media-cli models --type video --json
# Generate images
ai-media-cli generate -p "a cute robot painting" -m nano-banana-2 --wait
ai-media-cli generate -p "cinematic landscape" -m nano-banana-2 -a 16:9 --wait
ai-media-cli generate -p "portrait" -m nano-banana-2 -n "blurry, low quality" --wait
# Generate video
ai-media-cli generate -p "ocean waves" -m kling-v2 --type text-to-video --duration 5 --sound --wait
# Image-to-video
ai-media-cli generate -p "camera zoom" -m kling-v2 --type image-to-video --source-urls URL --wait
# Image-to-image
ai-media-cli generate -p "watercolor style" -m 5-lite-image-to-image --type image-to-image --source-urls URL --wait
# Music
ai-media-cli music -p "lo-fi hip hop beat" --instrumental --wait
ai-media-cli music -p "epic orchestral soundtrack" -m V5 --wait
# Text-to-speech
ai-media-cli dialogue -d '[{"text":"Hello!","voice":"Adam"},{"text":"Hi!","voice":"Emily"}]'
# Ad copy
ai-media-cli ad-copy -r https://example.com/ad.png --product-text "Premium headphones" --variants 3
ai-media-cli upload -f ./photo.jpg # Upload media
ai-media-cli status -i GENERATION_ID --wait # Check/poll status
ai-media-cli balance # Check credits
ai-media-cli generations --status completed # List generations
All generate options:
| Flag | Description | Default |
|---|---|---|
-p, --prompt | Generation prompt (required) | — |
-m, --model | Model (required) | — |
-t, --type | text-to-image, image-to-image, text-to-video, image-to-video | text-to-image |
-n, --negative-prompt | What to avoid | "" |
-a, --aspect-ratio | 1:1, 16:9, 9:16, etc. | 1:1 |
-d, --duration | Video duration (seconds) | — |
-q, --quality | Quality level | — |
-s, --seed | Reproducibility seed | 0 |
--sound | Enable audio on video | false |
--fixed-lens | Fixed camera lens | false |
--source-urls | Source media URLs | — |
-w, --wait | Poll until done | false |
Full CLI reference: docs/CLI_REFERENCE.md
import { AIImageClient } from "ai-media-cli";
const client = new AIImageClient({
apiKey: process.env.AI_IMAGE_API_KEY!,
});
const gen = await client.generateMedia({
prompt: "a futuristic city with flying cars",
model: "nano-banana-2",
aspect_ratio: "16:9",
negative_prompt: "blurry, watermark",
});
const result = await client.pollForCompletion(gen.generation_id);
console.log("Image URL:", result.outputs?.[0]?.url);
const video = await client.generateMedia({
prompt: "timelapse of clouds over mountains",
model: "kling-v2",
generation_type: "text-to-video",
duration: "5",
sound: true,
});
const result = await client.pollForCompletion(video.generation_id);
const music = await client.generateMusic({
prompt: "energetic rock anthem",
instrumental: false,
model: "V5",
});
const result = await client.pollForCompletion(music.generation_id, "music");
const speech = await client.generateDialogue({
dialogue: [
{ text: "Welcome to our podcast!", voice: "Adam" },
{ text: "Thanks for having me!", voice: "Emily" },
],
stability: 0.7,
language_code: "en",
});
import { AIImageClient, APIError, TimeoutError } from "ai-media-cli";
try {
await client.generateMedia({ prompt: "test", model: "bad" });
} catch (error) {
if (error instanceof APIError) {
console.error(`HTTP ${error.statusCode}: ${error.message}`);
if (error.isRateLimited) console.error("Slow down!");
if (error.isUnauthorized) console.error("Check your API key");
}
if (error instanceof TimeoutError) {
console.error(`Timed out after ${error.attempts} polls`);
}
}
import { AIImageClient, APIError, ConfigError, TimeoutError } from "ai-media-cli";
import type {
ClientOptions,
GenerateMediaRequest,
GenerateMusicRequest,
GenerateDialogueRequest,
GenerateAdCopyRequest,
GenerateResponse,
DialogueLine,
GenerationStatus,
GenerationOutput,
BalanceResponse,
UploadResponse,
GenerationsListParams,
ModelsResponse,
Model,
} from "ai-media-cli";
Full library guide: docs/LIBRARY_USAGE.md
Kubeez uses a credit-based system. Each model has a different cost per generation.
90+ models across 8 providers. Highlights:
| Model | Provider | Credits | Speed |
|---|---|---|---|
Z-image | Alibaba | 3 | ~4s |
nano-banana | 7 | ~10s | |
imagen-4-fast | 7 | ~30s | |
seedream-v4-5 | ByteDance | 9 | ~21s |
flux-2-1K | Black Forest Labs | 10 | ~32s |
gpt-1.5-image-medium | OpenAI | 10 | ~34s |
imagen-4 | 13 | ~33s | |
nano-banana-2 | 14 | ~42s | |
grok-text-to-image | xAI | 14 | ~30s |
gpt-1.5-image-high | OpenAI | 32 | ~30s |
| Model | Provider | Credits | Details |
|---|---|---|---|
seedance-1-5-pro-480p-4s | ByteDance | 12 | 4s 480p |
kling-2-6-text-to-video-5s | Kuaishou | 90 | 5s |
veo3-1-fast-text-to-video | 99 | Fast | |
kling-3-0-pro | Kuaishou | 125 | Pro quality |
kling-2-6-text-to-video-5s-audio | Kuaishou | 175 | 5s + audio |
veo3-1-text-to-video | 390 | High quality |
| Model | Credits | Features |
|---|---|---|
V5 (default) | 19 | Vocals + instrumental |
V4_5PLUS | 19 | Vocals + instrumental |
suno-lyrics-generation | 2 | Lyrics only |
text-to-dialogue-v3 | 21 | Multi-speaker TTS (ElevenLabs) |
| Plan | Best For | Savings |
|---|---|---|
| Free Trial | Testing (free credits on signup) | — |
| Starter | Light experimentation | 4% vs. PAYG |
| Pro | Full experience (most popular) | ~20% vs. PAYG |
| Powerhouse | High-volume production | ~44% vs. PAYG |
Yearly billing saves an additional ~16%. See kubeez.com/pricing.
# Check real-time model pricing
ai-media-cli models
# Check your balance
ai-media-cli balance
Full models list: docs/MODELS.md
for i in 1 2 3 4 5; do
ai-media-cli generate -p "abstract art variation $i" -m nano-banana-2 --seed $i --wait
done
URL=$(ai-media-cli upload -f photo.jpg | jq -r '.url')
ai-media-cli generate -p "anime style" -m 5-lite-image-to-image --type image-to-image --source-urls "$URL" --wait
import express from "express";
import { AIImageClient } from "ai-media-cli";
const app = express();
const client = new AIImageClient({ apiKey: process.env.AI_IMAGE_API_KEY! });
app.use(express.json());
app.post("/api/generate", async (req, res) => {
const { prompt, model = "nano-banana-2" } = req.body;
const gen = await client.generateMedia({ prompt, model });
const result = await client.pollForCompletion(gen.generation_id);
res.json(result);
});
app.listen(3000);
import { AIImageClient } from "ai-media-cli";
const client = new AIImageClient({ apiKey: process.env.AI_IMAGE_API_KEY! });
const gen = await client.generateMedia({
prompt: "tech company banner, gradient purple to blue, minimalist",
model: "nano-banana-2",
aspect_ratio: "16:9",
});
const result = await client.pollForCompletion(gen.generation_id);
if (result.status === "completed") {
console.log("Ready:", result.outputs?.[0]?.url);
}
git clone https://github.com/sebyx07/js-ai-image-cli.git
cd js-ai-image-cli
bun install
bun run dev -- --help # Run CLI
bun test # 46 tests
bun run lint # Biome linting
bun run build # TypeScript build
FAQs
The easiest way to generate AI images, videos, music & speech from JavaScript/TypeScript — as a CLI, npx command, or library.
The npm package ai-media-cli receives a total of 15 weekly downloads. As such, ai-media-cli popularity was classified as not popular.
We found that ai-media-cli demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Product
Socket’s PHP and Composer support is now in Beta for all customers, with PHP reachability analysis generally available.

Product
Socket is bringing experimental protection to Firefox, scanning 97,000+ extensions in Mozilla's official directory for malware and risky updates.

Research
/Security News
Three compromised Rust crates pulled in a malicious dependency that downloaded and executed cross-platform malware during Cargo builds.