Kie Image Generator
Overview
Generate high-quality AI images using Kie.ai's comprehensive collection of image generation models. This skill provides access to 13+ state-of-the-art models including GPT-4O Image, Flux Kontext Pro/Max, Nano Banana, Nano Banana Pro (DeepSeed), Seedream 4.0, Imagen 4 variants, Ideogram V3, and Ideogram Character.
Key Features:
- 13+ AI image models with diverse capabilities
- Credit/cost tracking and usage reporting
- Interactive model selection with cost comparison
- Automatic task polling and download
Quick Start
Check account credits:
python scripts/generate_image.py --credits
List available models with pricing:
python scripts/generate_image.py --list-models
Interactive mode (select model with cost display):
python scripts/generate_image.py "a beautiful sunset over mountains"
Direct model selection:
python scripts/generate_image.py "cyberpunk city" --model flux-kontext-pro
Skip confirmation:
python scripts/generate_image.py "abstract art" --model seedream-v4 -y
Supported Models
1. GPT-4O Image (gpt4o-image)
- Best for: Text rendering, complex scenes, photorealistic images
- Parameters:
prompt, size (1:1, 3:2, 2:3), nVariants (1-4)
- Speed: Medium (~20-30s)
2. Flux Kontext Pro (flux-kontext-pro)
- Best for: Fast creative generation, artistic styles
- Parameters:
prompt, image_ratio (16:9, 21:9, 4:3, 1:1, 3:4, 9:16), output_format (jpeg, png)
- Speed: Fast (8x faster than GPT-Image)
3. Flux Kontext Max (flux-kontext-max)
- Best for: High precision, typography, consistency
- Parameters: Same as Flux Kontext Pro
- Speed: Medium
4. Nano Banana (nano-banana)
- Best for: Hyper-realistic, physics-aware visuals
- Parameters:
prompt, output_format (PNG, JPEG), image_size (1:1, 9:16, 16:9, 3:4, 4:3, etc.)
- Speed: Fast (~10-20s)
5. Nano Banana Pro (nano-banana-pro) ✨ NEW
- Best for: 3K/4K images, text rendering, character consistency
- Parameters:
prompt, aspect_ratio (1:1, 3:2, 16:9, etc.), resolution (sd, hd, 4k), format (jpg, png, webp), image_input (reference images)
- Speed: Fast
- Pricing: $0.04 (768px) / $0.11 (1024px)
6. Seedream 4.0 (seedream-v4)
- Best for: Fast generation, 2K-4K resolution
- Parameters:
prompt, image_size, image_resolution (1K, 2K, 4K), max_images (1-6), seed
- Speed: Very fast (~1.8s for 2K)
7. Imagen 4 Ultra (imagen-4-ultra)
- Best for: Photorealistic, high-quality visuals
- Parameters:
prompt, negative_prompt, aspect_ratio (1:1, 16:9, 9:16, 3:4, 4:3), num_images (1-4), seed
- Speed: Very fast (10x faster)
8. Imagen 4 (imagen-4)
- Best for: Balanced quality and speed
- Parameters: Same as Imagen 4 Ultra
- Speed: Fast
9. Imagen 4 Fast (imagen-4-fast)
- Best for: Quick iterations, drafts
- Parameters: Same as Imagen 4 Ultra
- Speed: Very fast
10. Ideogram V3 (ideogram-v3)
- Best for: Text rendering, typography
- Parameters:
prompt, rendering_speed (TURBO, BALANCED, QUALITY), style (AUTO, GENERAL, REALISTIC, DESIGN), image_size, num_images (1-4), expand_prompt, seed, negative_prompt
- Speed: Variable (depends on rendering_speed)
11. Ideogram Character (ideogram-character)
- Best for: Character consistency, portraits
- Parameters:
prompt, reference_image_urls, rendering_speed, style (AUTO, REALISTIC, FICTION), num_images (1-4), expand_prompt, seed
- Speed: Variable
Workflow
Step 1: Environment Setup
Ensure .env file exists in the skill directory with Kie.ai API key:
KIEAI_API_KEY=your_api_key_here
If .env doesn't exist, the script will create it from .env.example and prompt for API key.
Step 2: Generate Image
Run the generation script with desired parameters:
# Basic generation
python scripts/generate_image.py "prompt"
# With model selection
python scripts/generate_image.py "prompt" --model MODEL_ID
# With advanced parameters
python scripts/generate_image.py "prompt" \
--model gpt4o-image \
--size "3:2" \
--variants 2 \
--output ~/Downloads/images/
Step 3: Task Polling
The script automatically:
- Submits generation task to Kie.ai
- Polls for completion (every 2 seconds)
- Downloads completed image
- Saves to output directory with timestamped filename
Advanced Usage
Model-Specific Parameters
Each model has a dedicated module in scripts/models/ with full parameter support:
GPT-4O Image:
python scripts/generate_image.py "sunset" \
--model gpt4o-image \
--size "16:9" \
--variants 4
Flux Kontext:
python scripts/generate_image.py "abstract art" \
--model flux-kontext-pro \
--ratio "21:9" \
--format jpeg
Nano Banana Pro:
python scripts/generate_image.py "cinematic poster cool banana hero" \
--model nano-banana-pro \
--aspect-ratio "16:9" \
--resolution 4k \
--format png
Seedream 4.0:
python scripts/generate_image.py "landscape" \
--model seedream-v4 \
--resolution 4K \
--images 4 \
--seed 12345
Imagen 4:
python scripts/generate_image.py "portrait" \
--model imagen-4-ultra \
--aspect-ratio "3:4" \
--negative "blurry, low quality" \
--seed 67890
Ideogram V3:
python scripts/generate_image.py "logo design" \
--model ideogram-v3 \
--rendering QUALITY \
--style DESIGN \
--expand-prompt
Batch Generation
Generate multiple variations:
# 4 variants of same prompt
python scripts/generate_image.py "cyberpunk city" --variants 4
# Multiple prompts
for prompt in "sunset" "moonrise" "starfield"; do
python scripts/generate_image.py "$prompt" --model imagen-4-fast
done
Resources
scripts/
generate_image.py - Main generation script with CLI interface
models/ - Model-specific parameter handlers
gpt4o.py - GPT-4O Image parameters
flux_kontext.py - Flux Kontext Pro/Max parameters
nano_banana.py - Nano Banana parameters
seedream.py - Seedream 4.0 parameters
imagen.py - Imagen 4 variants parameters
ideogram.py - Ideogram V3/Character parameters
utils.py - Common utilities (polling, download, env loading)
references/
api_docs.md - Comprehensive Kie.ai API documentation
Error Handling
The script handles common errors:
- Missing API key: Prompts to create .env file
- Invalid model: Lists available models
- Generation timeout: Retries or reports timeout (max 2 minutes)
- API errors: Displays error message and suggests solutions
Output Format
Generated images are saved with descriptive filenames:
~/Downloads/images/gpt4o-image_sunset_20250113_203045.png
~/Downloads/images/flux-kontext-pro_cyberpunk_20250113_203125.jpg
Format: {model}_{prompt-slug}_{timestamp}.{ext}
Credit System
Kie.ai uses a credit-based pricing system:
- 1 credit = $0.005 USD
- Credits are deducted upon task completion
- Use
--credits to check current balance
Estimated Credit Costs
| Model |
Est. Credits |
Est. USD |
| Nano Banana |
~20 |
$0.10 |
| Imagen 4 Fast |
~25 |
$0.12 |
| Nano Banana Edit |
~25 |
$0.12 |
| Flux Kontext Pro |
~30 |
$0.15 |
| Seedream V4 |
~35 |
$0.18 |
| Nano Banana Pro |
~40 |
$0.20 |
| Ideogram V3 |
~40 |
$0.20 |
| Seedream V4 Edit |
~40 |
$0.20 |
| Ideogram Character |
~45 |
$0.23 |
| GPT-4O Image |
~50 |
$0.25 |
| Imagen 4 |
~50 |
$0.25 |
| Flux Kontext Max |
~60 |
$0.30 |
| Imagen 4 Ultra |
~100 |
$0.50 |
Prices are estimates and may vary based on parameters.
Usage Tracking
After each generation, the script reports:
💰 Credits used: 45.0 ($0.23)
Remaining: 837.5 credits ($4.19)
This helps track spending and plan budget for generation tasks
1---2name: kie-image-generator3description: Generate images using Kie.ai's diverse AI models including GPT-4O Image, Flux Kontext, Nano Banana, Seedream, Imagen, and Ideogram. This skill should be used when the user requests AI-generated images, creative visuals, artwork creation, or image generation with specific styles. Supports 13+ models with full parameter control, automatic task polling, and usage tracking.4---56# Kie Image Generator78## Overview910Generate high-quality AI images using Kie.ai's comprehensive collection of image generation models. This skill provides access to 13+ state-of-the-art models including GPT-4O Image, Flux Kontext Pro/Max, Nano Banana, Nano Banana Pro (DeepSeed), Seedream 4.0, Imagen 4 variants, Ideogram V3, and Ideogram Character.1112**Key Features:**13- 13+ AI image models with diverse capabilities14- Credit/cost tracking and usage reporting15- Interactive model selection with cost comparison16- Automatic task polling and download1718## Quick Start1920**Check account credits:**21```bash22python scripts/generate_image.py --credits23```2425**List available models with pricing:**26```bash27python scripts/generate_image.py --list-models28```2930**Interactive mode (select model with cost display):**31```bash32python scripts/generate_image.py "a beautiful sunset over mountains"33```3435**Direct model selection:**36```bash37python scripts/generate_image.py "cyberpunk city" --model flux-kontext-pro38```3940**Skip confirmation:**41```bash42python scripts/generate_image.py "abstract art" --model seedream-v4 -y43```4445## Supported Models4647### 1. GPT-4O Image (gpt4o-image)48- **Best for:** Text rendering, complex scenes, photorealistic images49- **Parameters:** `prompt`, `size` (1:1, 3:2, 2:3), `nVariants` (1-4)50- **Speed:** Medium (~20-30s)5152### 2. Flux Kontext Pro (flux-kontext-pro)53- **Best for:** Fast creative generation, artistic styles54- **Parameters:** `prompt`, `image_ratio` (16:9, 21:9, 4:3, 1:1, 3:4, 9:16), `output_format` (jpeg, png)55- **Speed:** Fast (8x faster than GPT-Image)5657### 3. Flux Kontext Max (flux-kontext-max)58- **Best for:** High precision, typography, consistency59- **Parameters:** Same as Flux Kontext Pro60- **Speed:** Medium6162### 4. Nano Banana (nano-banana)63- **Best for:** Hyper-realistic, physics-aware visuals64- **Parameters:** `prompt`, `output_format` (PNG, JPEG), `image_size` (1:1, 9:16, 16:9, 3:4, 4:3, etc.)65- **Speed:** Fast (~10-20s)6667### 5. Nano Banana Pro (nano-banana-pro) ✨ NEW68- **Best for:** 3K/4K images, text rendering, character consistency69- **Parameters:** `prompt`, `aspect_ratio` (1:1, 3:2, 16:9, etc.), `resolution` (sd, hd, 4k), `format` (jpg, png, webp), `image_input` (reference images)70- **Speed:** Fast71- **Pricing:** $0.04 (768px) / $0.11 (1024px)7273### 6. Seedream 4.0 (seedream-v4)74- **Best for:** Fast generation, 2K-4K resolution75- **Parameters:** `prompt`, `image_size`, `image_resolution` (1K, 2K, 4K), `max_images` (1-6), `seed`76- **Speed:** Very fast (~1.8s for 2K)7778### 7. Imagen 4 Ultra (imagen-4-ultra)79- **Best for:** Photorealistic, high-quality visuals80- **Parameters:** `prompt`, `negative_prompt`, `aspect_ratio` (1:1, 16:9, 9:16, 3:4, 4:3), `num_images` (1-4), `seed`81- **Speed:** Very fast (10x faster)8283### 8. Imagen 4 (imagen-4)84- **Best for:** Balanced quality and speed85- **Parameters:** Same as Imagen 4 Ultra86- **Speed:** Fast8788### 9. Imagen 4 Fast (imagen-4-fast)89- **Best for:** Quick iterations, drafts90- **Parameters:** Same as Imagen 4 Ultra91- **Speed:** Very fast9293### 10. Ideogram V3 (ideogram-v3)94- **Best for:** Text rendering, typography95- **Parameters:** `prompt`, `rendering_speed` (TURBO, BALANCED, QUALITY), `style` (AUTO, GENERAL, REALISTIC, DESIGN), `image_size`, `num_images` (1-4), `expand_prompt`, `seed`, `negative_prompt`96- **Speed:** Variable (depends on rendering_speed)9798### 11. Ideogram Character (ideogram-character)99- **Best for:** Character consistency, portraits100- **Parameters:** `prompt`, `reference_image_urls`, `rendering_speed`, `style` (AUTO, REALISTIC, FICTION), `num_images` (1-4), `expand_prompt`, `seed`101- **Speed:** Variable102103## Workflow104105### Step 1: Environment Setup106107Ensure `.env` file exists in the skill directory with Kie.ai API key:108```bash109KIEAI_API_KEY=your_api_key_here110```111112If `.env` doesn't exist, the script will create it from `.env.example` and prompt for API key.113114### Step 2: Generate Image115116Run the generation script with desired parameters:117118```bash119# Basic generation120python scripts/generate_image.py "prompt"121122# With model selection123python scripts/generate_image.py "prompt" --model MODEL_ID124125# With advanced parameters126python scripts/generate_image.py "prompt" \127 --model gpt4o-image \128 --size "3:2" \129 --variants 2 \130 --output ~/Downloads/images/131```132133### Step 3: Task Polling134135The script automatically:1361. Submits generation task to Kie.ai1372. Polls for completion (every 2 seconds)1383. Downloads completed image1394. Saves to output directory with timestamped filename140141## Advanced Usage142143### Model-Specific Parameters144145Each model has a dedicated module in `scripts/models/` with full parameter support:146147**GPT-4O Image:**148```bash149python scripts/generate_image.py "sunset" \150 --model gpt4o-image \151 --size "16:9" \152 --variants 4153```154155**Flux Kontext:**156```bash157python scripts/generate_image.py "abstract art" \158 --model flux-kontext-pro \159 --ratio "21:9" \160 --format jpeg161```162163**Nano Banana Pro:**164```bash165python scripts/generate_image.py "cinematic poster cool banana hero" \166 --model nano-banana-pro \167 --aspect-ratio "16:9" \168 --resolution 4k \169 --format png170```171172**Seedream 4.0:**173```bash174python scripts/generate_image.py "landscape" \175 --model seedream-v4 \176 --resolution 4K \177 --images 4 \178 --seed 12345179```180181**Imagen 4:**182```bash183python scripts/generate_image.py "portrait" \184 --model imagen-4-ultra \185 --aspect-ratio "3:4" \186 --negative "blurry, low quality" \187 --seed 67890188```189190**Ideogram V3:**191```bash192python scripts/generate_image.py "logo design" \193 --model ideogram-v3 \194 --rendering QUALITY \195 --style DESIGN \196 --expand-prompt197```198199### Batch Generation200201Generate multiple variations:202```bash203# 4 variants of same prompt204python scripts/generate_image.py "cyberpunk city" --variants 4205206# Multiple prompts207for prompt in "sunset" "moonrise" "starfield"; do208 python scripts/generate_image.py "$prompt" --model imagen-4-fast209done210```211212## Resources213214### scripts/215- `generate_image.py` - Main generation script with CLI interface216- `models/` - Model-specific parameter handlers217 - `gpt4o.py` - GPT-4O Image parameters218 - `flux_kontext.py` - Flux Kontext Pro/Max parameters219 - `nano_banana.py` - Nano Banana parameters220 - `seedream.py` - Seedream 4.0 parameters221 - `imagen.py` - Imagen 4 variants parameters222 - `ideogram.py` - Ideogram V3/Character parameters223- `utils.py` - Common utilities (polling, download, env loading)224225### references/226- `api_docs.md` - Comprehensive Kie.ai API documentation227228## Error Handling229230The script handles common errors:231- **Missing API key:** Prompts to create .env file232- **Invalid model:** Lists available models233- **Generation timeout:** Retries or reports timeout (max 2 minutes)234- **API errors:** Displays error message and suggests solutions235236## Output Format237238Generated images are saved with descriptive filenames:239```240~/Downloads/images/gpt4o-image_sunset_20250113_203045.png241~/Downloads/images/flux-kontext-pro_cyberpunk_20250113_203125.jpg242```243244Format: `{model}_{prompt-slug}_{timestamp}.{ext}`245246## Credit System247248Kie.ai uses a credit-based pricing system:249- **1 credit = $0.005 USD**250- Credits are deducted upon task completion251- Use `--credits` to check current balance252253### Estimated Credit Costs254255| Model | Est. Credits | Est. USD |256|-------|-------------|----------|257| Nano Banana | ~20 | $0.10 |258| Imagen 4 Fast | ~25 | $0.12 |259| Nano Banana Edit | ~25 | $0.12 |260| Flux Kontext Pro | ~30 | $0.15 |261| Seedream V4 | ~35 | $0.18 |262| Nano Banana Pro | ~40 | $0.20 |263| Ideogram V3 | ~40 | $0.20 |264| Seedream V4 Edit | ~40 | $0.20 |265| Ideogram Character | ~45 | $0.23 |266| GPT-4O Image | ~50 | $0.25 |267| Imagen 4 | ~50 | $0.25 |268| Flux Kontext Max | ~60 | $0.30 |269| Imagen 4 Ultra | ~100 | $0.50 |270271*Prices are estimates and may vary based on parameters.*272273## Usage Tracking274275After each generation, the script reports:276```277💰 Credits used: 45.0 ($0.23)278 Remaining: 837.5 credits ($4.19)279```280281This helps track spending and plan budget for generation tasks