# Kie AI

> Unified API integration for kie.ai media generation services. Use when generating video (Veo3.1, Runway), audio/music (Suno), or images (GPT-4o, Flux Kontext). Applies for text-to-video, text-to-image, music generation, video modification, vocal removal, lyric generation, or any AI media creation task. Supports async task polling, automatic media download, bulk operations, and file uploads.

- Skill: `buzzmatic/kie-ai` (Agent Skill, multi-file: 31 files)
- Install (CLI): `npx skillmds@latest add buzzmatic/kie-ai`
- Raw SKILL.md: https://api.skillmd.com/api/skills/buzzmatic/kie-ai/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: Buzzmatic (https://skillmd.com/u/buzzmatic)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/buzzmatic/kie-ai

---


# kie.ai Media Generation

Generate video, audio, and images using kie.ai's unified API for Veo3.1, Runway, Luma, Suno, GPT-4o, and Flux Kontext.

## Environment Setup

```bash
export KIE_AI_API_KEY="your_api_key"
export KIE_AI_POLL_INTERVAL=5      # Optional: seconds between polls (default: 5)
export KIE_AI_MAX_POLL_ATTEMPTS=120 # Optional: max poll attempts (default: 120)
```

## Quick Reference

| Task | Script | Key Params |
|------|--------|------------|
| Generate video | `video/veo_generate.py` | `--prompt`, `--model veo3\|veo3_fast` |
| Generate music | `audio/suno_generate.py` | `--prompt`, `--model V4_5`, `--style` |
| Generate image | `image/gpt4o_generate.py` | `--prompt`, `--size`, `--variants` |
| Flux image | `image/flux_generate.py` | `--prompt`, `--model flux-kontext-pro` |
| Upload file | `upload/upload_base64.py` | `--file` |
| Check credits | `common/get_credits.py` | |
| Bulk generate | `bulk/bulk_generate.py` | `--config`, `--batch-size` |

## Video Generation

### Veo3.1 (Google)

```bash
python skills/kie-ai/scripts/video/veo_generate.py \
  --prompt "A cat playing piano in a jazz club" \
  --model veo3 \
  --aspect-ratio "16:9"
```

Options: `--model veo3|veo3_fast`, `--aspect-ratio`, `--image-urls`, `--get-hd`, `--no-poll`

### Runway

```bash
python skills/kie-ai/scripts/video/runway_generate.py \
  --prompt "Drone shot over mountain peaks at sunrise" \
  --duration 10 \
  --quality 1080p
```

Options: `--duration 5|10`, `--quality 720p|1080p`, `--aspect-ratio`, `--image-url`

Extend: `python skills/kie-ai/scripts/video/runway_extend.py --task-id TASK_ID`

### Luma (Video Modification)

```bash
python skills/kie-ai/scripts/video/luma_modify.py \
  --prompt "Add lens flare and cinematic color grading" \
  --video-url "https://..."
```

## Audio Generation (Suno)

### Generate Music

```bash
python skills/kie-ai/scripts/audio/suno_generate.py \
  --prompt "Upbeat jazz with piano and saxophone" \
  --model V4_5 \
  --style "jazz, piano, upbeat"
```

Options: `--model V3_5|V4|V4_5|V4_5PLUS|V4_5ALL|V5`, `--custom-mode`, `--instrumental`, `--title`

### Additional Audio Operations

| Operation | Script | Description |
|-----------|--------|-------------|
| Extend track | `audio/suno_extend.py` | Continue existing track |
| Generate lyrics | `audio/suno_lyrics.py` | AI-generated lyrics |
| Convert to WAV | `audio/suno_wav.py` | Lossless conversion |
| Remove vocals | `audio/suno_vocal_removal.py` | Stem separation |
| Create music video | `audio/suno_video.py` | Visualizer video |
| Boost style | `audio/suno_style.py` | Enhance production |

## Image Generation

### GPT-4o

```bash
python skills/kie-ai/scripts/image/gpt4o_generate.py \
  --prompt "Abstract digital art with vibrant neon colors" \
  --size "16:9" \
  --variants 2
```

Options: `--size 1:1|3:2|2:3`, `--variants 1|2|4`, `--files-url` (up to 5), `--mask-url`, `--enhance`

### Flux Kontext

```bash
python skills/kie-ai/scripts/image/flux_generate.py \
  --prompt "Professional product photo on marble surface" \
  --model flux-kontext-max \
  --aspect-ratio "4:3"
```

Options: `--model flux-kontext-pro|flux-kontext-max`, `--output-format jpeg|png`, `--input-image`

## File Upload

```bash
# Base64 upload (up to 10MB)
python skills/kie-ai/scripts/upload/upload_base64.py --file /path/to/file

# Stream upload (multipart)
python skills/kie-ai/scripts/upload/upload_stream.py --file /path/to/file

# URL upload (up to 100MB)
python skills/kie-ai/scripts/upload/upload_url.py --url "https://..."
```

Uploaded files expire in 3 days.

## Bulk Operations

### Batch Generation

Create config file:
```json
{
  "requests": [
    {"id": "vid_001", "endpoint": "veo", "params": {"prompt": "...", "model": "veo3"}},
    {"id": "img_001", "endpoint": "gpt4o", "params": {"prompt": "...", "size": "1:1"}},
    {"id": "mus_001", "endpoint": "suno", "params": {"prompt": "...", "model": "V4_5"}}
  ]
}
```

Run batch:
```bash
python skills/kie-ai/scripts/bulk/bulk_generate.py \
  --config bulk_config.json \
  --batch-size 5
```

### Check Multiple Tasks

```bash
python skills/kie-ai/scripts/bulk/bulk_status.py \
  --task-ids "task1,task2,task3" \
  --endpoint veo
```

## Output Format

All scripts return:
```json
{
  "success": true,
  "task_id": "xxx",
  "status": "success",
  "output_files": ["output/file.mp4"],
  "summary": "Video generated: 1 file(s) downloaded"
}
```

All files (raw responses, summaries, and generated media) are saved to `./output/` by default. Override with `--output-dir`.

## Important Notes

- **Rate Limits:** 20 requests per 10 seconds (automatic throttling)
- **Download URLs:** Expire in 20 minutes (auto-downloaded by scripts)
- **Generated Media:** Retained 14 days
- **Uploaded Files:** Retained 3 days
- **Polling:** Automatic with exponential backoff (5s to 30s intervals)

For detailed API parameters and error codes, see [references/api_reference.md](references/api_reference.md).

