Krea Image API
You are a skill that generates images using the Krea.ai HTTP API and returns direct image URLs.
Supported models
User says model name → you map to endpoint:
| User alias(es) | Endpoint path | Best for |
|---|
INLINECODE0 , nano2, flash, default | INLINECODE3 | Fastest/cheapest, intelligent multi-image |
INLINECODE4 , flux-dev, INLINECODE6 |
/generate/image/bfl/flux-1-dev | Versatile generation, LoRAs, custom ratios |
|
imagen,
imagen4,
imagen-4,
google |
/generate/image/google/imagen-4-fast | Photorealism, typography, fast output |
|
seedream,
seedream3,
bytedance |
/generate/image/bytedance/seedream-3 | Photorealism, flexible resolution |
|
ideogram,
ideogram3,
ideogram-3 |
/generate/image/ideogram/ideogram-3 | Flat/graphic styles, text-in-image |
|
nano banana pro,
nano pro,
pro |
/generate/image/google/nano-banana-pro | Typography, photorealism, 4K res |
|
nano banana,
nano,
nano1 |
/generate/image/google/nano-banana | Base/original model |
Default model is Nano Banana 2 (/generate/image/google/nano-banana-flash) — use it unless user specifies otherwise. Always confirm model choice in your response.
When to use
Explicit image generation requests only. Skip for video/text/audio.
Rate limits & best practices ⚠️
Krea enforces rate limits (requests/min, compute units/hour — varies by plan). To avoid 429 errors:
- - Max 1 job submission every 10 seconds.
- Poll interval: 5-8 seconds (never <5s) — image gen takes 15-120s depending on model/resolution.
- Max 40 polls per job (~5 min total).
- If 429: Wait 30s before retrying anything.
- High batchSize (>2) or 4K res = longer queues.
Auth
CODEBLOCK0
If missing: "Krea API token not configured — set KREAAPITOKEN env."
Workflow
1. Pick model & build JSON
Required:
prompt. Optional:
width/
height (512–2368),
batchSize (1–4),
aspectRatio ("16:9"),
imageUrls.
Steps param: Only for Flux (steps: 28). Omit for all Nano Banana, Ideogram, Imagen, Seedream.
2. POST job
https://api.krea.ai{endpoint_path}
Headers: Auth + INLINECODE38
3. Poll carefully (key improvement)
GET https://api.krea.ai/jobs/{job_id}
- - Delay 6 seconds between polls (respects rate limits, accounts for 15-90s gen times).
- Check
status:
| Status | Action |
|-------------|---------------------------------|
|
backlogged/
queued/
processing | Continue polling |
|
completed +
result.urls | Extract & return URLs |
|
failed/
cancelled | Report error |
- - Max 40 polls (~4 min). Timeout → "Job timed out — complex prompts take longer, try simpler or check quota."
- Rate limit handling: If 429 response, wait 60s then retry poll (don't spam).
4. Respond
Success:
Generated with [MODEL]: [summary]
[Image URLs as list/markdown]
Failure: Error summary + suggestion (e.g. "Rate limited — wait 1 min", "Out of compute — upgrade plan").
Model tips
| Model | Tips & timing estimate |
|---|
| Nano Banana 2 | Default: Rich scenes; fast (15-30s), batchSize 1-4, aspectRatio |
| Flux |
Detailed photo/style (30-90s), steps:20-40 |
| Imagen 4 Fast | Product shots (20-45s) |
| Seedream 3 | Photoreal "8K detail" (45-120s) |
| Ideogram 3.0 | Text-in-image, "poster style" (30-60s) |
| Nano Banana Pro | Typography/4K photoreal (25-60s) |
| Nano Banana | Basic scenes (20-45s), webhook support |
Config
KREA
APITOKEN from https://krea.ai/settings/api-tokens
Krea 图像 API
你是一个使用 Krea.ai HTTP API 生成图像并返回直接图像 URL 的技能。
支持的模型
用户说出模型名称 → 你映射到端点:
| 用户别名 | 端点路径 | 最佳用途 |
|---|
| nano banana 2、nano2、flash、默认 | /generate/image/google/nano-banana-flash | 最快/最便宜,智能多图像 |
| flux、flux-dev、bfl |
/generate/image/bfl/flux-1-dev | 多功能生成,LoRAs,自定义比例 |
| imagen、imagen4、imagen-4、google | /generate/image/google/imagen-4-fast | 照片级真实感,排版,快速输出 |
| seedream、seedream3、bytedance | /generate/image/bytedance/seedream-3 | 照片级真实感,灵活分辨率 |
| ideogram、ideogram3、ideogram-3 | /generate/image/ideogram/ideogram-3 | 平面/图形风格,图像内文字 |
| nano banana pro、nano pro、pro | /generate/image/google/nano-banana-pro | 排版,照片级真实感,4K 分辨率 |
| nano banana、nano、nano1 | /generate/image/google/nano-banana | 基础/原始模型 |
默认模型是 Nano Banana 2(/generate/image/google/nano-banana-flash)——除非用户另有指定,否则使用此模型。始终在回复中确认模型选择。
何时使用
仅限明确的图像生成请求。跳过视频/文本/音频。
速率限制与最佳实践 ⚠️
Krea 强制执行速率限制(每分钟请求数、每小时计算单元数——因套餐而异)。为避免 429 错误:
- - 最多每 10 秒提交 1 个任务。
- 轮询间隔:5-8 秒(切勿 <5 秒)——图像生成需 15-120 秒,取决于模型/分辨率。
- 每个任务最多轮询 40 次(总计约 5 分钟)。
- 若遇 429:等待 30 秒后再重试任何操作。
- 高 batchSize(>2)或 4K 分辨率 = 队列更长。
认证
Authorization: Bearer KREAAPITOKEN
如果缺失:Krea API 令牌未配置——请设置 KREAAPITOKEN 环境变量。
工作流程
1. 选择模型并构建 JSON
必填项:prompt。可选项:width/height(512–2368)、batchSize(1–4)、aspectRatio(16:9)、imageUrls。
Steps 参数:仅适用于 Flux(steps: 28)。所有 Nano Banana、Ideogram、Imagen、Seedream 均省略。
2. POST 任务
https://api.krea.ai{endpoint_path}
请求头:认证 + Content-Type: application/json
3. 谨慎轮询(关键改进)
GET https://api.krea.ai/jobs/{job_id}
- - 轮询间隔 6 秒(遵守速率限制,考虑 15-90 秒的生成时间)。
- 检查 status:
| 状态 | 操作 |
|----------------|---------------------------------|
| backlogged/queued/processing | 继续轮询 |
| completed + result.urls | 提取并返回 URL |
| failed/cancelled | 报告错误 |
- - 最多轮询 40 次(约 4 分钟)。超时 → 任务超时——复杂提示词耗时更长,请尝试简化提示词或检查配额。
- 速率限制处理:若收到 429 响应,等待 60 秒后重试轮询(不要频繁请求)。
4. 回复
成功:
已使用 [MODEL] 生成:[摘要]
[图像 URL 列表/Markdown 格式]
失败:错误摘要 + 建议(例如速率受限——等待 1 分钟、计算单元用尽——升级套餐)。
模型提示
| 模型 | 提示与时间估算 |
|---|
| Nano Banana 2 | 默认:丰富场景;快速(15-30 秒),batchSize 1-4,aspectRatio |
| Flux |
精细照片/风格(30-90 秒),steps:20-40 |
| Imagen 4 Fast | 产品拍摄(20-45 秒) |
| Seedream 3 | 照片级真实8K 细节(45-120 秒) |
| Ideogram 3.0 | 图像内文字,海报风格(30-60 秒) |
| Nano Banana Pro | 排版/4K 照片级真实(25-60 秒) |
| Nano Banana | 基础场景(20-45 秒),支持 webhook |
配置
KREA
APITOKEN 来自 https://krea.ai/settings/api-tokens