krea-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseKrea.ai Image Generation Skill
Krea.ai 图片生成Skill
Generate images using Krea.ai's API with support for multiple models including Flux, Imagen 4, Ideogram 3.0, and more.
通过Krea.ai的API生成图片,支持包括Flux、Imagen 4、Ideogram 3.0等在内的多种模型。
Features
功能特性
- Async job-based generation (POST → poll → result)
- Support for multiple image models
- Configurable parameters (width, height, steps, guidance, seed, etc.)
- Webhook support for background completion
- Stdlib-only dependencies (no required)
requests
- 基于异步任务的生成流程(POST请求 → 轮询 → 获取结果)
- 支持多种图片生成模型
- 可配置参数(宽度、高度、步数、引导系数、随机种子等)
- 支持Webhook实现后台完成通知
- 仅依赖Stdlib库(无需)
requests
Setup
配置步骤
- Get your Krea.ai API credentials from https://docs.krea.ai/developers/api-keys-and-billing
- Configure with:
bash
clawdbot config set skill.krea_api.key_id YOUR_KEY_ID
clawdbot config set skill.krea_api.secret YOUR_SECRET- Or pass credentials directly as arguments.
bash
clawdbot config set skill.krea_api.key_id YOUR_KEY_ID
clawdbot config set skill.krea_api.secret YOUR_SECRET- 或者直接将凭证作为参数传入。
Usage
使用方法
Interactive Mode
交互模式
You: Generate a sunset over the ocean with Flux
Klawf: Creates the image and returns the URL你:用Flux生成一张海上日落的图片
Klawf:创建图片并返回URLPython Script
Python脚本
python
from krea_api import KreaAPI
api = KreaAPI(
key_id="your-key-id",
secret="your-secret"
)python
from krea_api import KreaAPI
api = KreaAPI(
key_id="your-key-id",
secret="your-secret"
)Generate and wait
生成并等待结果
urls = api.generate_and_wait(
prompt="A serene Japanese garden",
model="flux",
width=1024,
height=1024
)
print(urls)
undefinedurls = api.generate_and_wait(
prompt="宁静的日式庭院",
model="flux",
width=1024,
height=1024
)
print(urls)
undefinedAvailable Models (examples)
可用模型(示例)
| Model | Endpoint |
|---|---|
| flux | |
| flux-kontext | |
| flux-1.1-pro | |
| imagen-3 | |
| imagen-4 | |
| ideogram-3.0 | |
| seedream-4 | |
For the full list, run:
bash
python3 krea_api.py --list-models| 模型 | 接口地址 |
|---|---|
| flux | |
| flux-kontext | |
| flux-1.1-pro | |
| imagen-3 | |
| imagen-4 | |
| ideogram-3.0 | |
| seedream-4 | |
查看完整模型列表,请运行:
bash
python3 krea_api.py --list-modelsParameters
参数说明
| Parameter | Type | Default | Description |
|---|---|---|---|
| prompt | str | required | Image description (max 1800 chars) |
| model | str | "flux" | Model name from table above |
| width | int | 1024 | Image width (512-2368) |
| height | int | 1024 | Image height (512-2368) |
| steps | int | 25 | Generation steps (1-100) |
| guidance_scale | float | 3.0 | Guidance scale (0-24) |
| seed | str | None | Random seed for reproducibility |
| webhook_url | str | None | URL for completion notification |
| 参数 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| prompt | 字符串 | 必填 | 图片描述(最多1800字符) |
| model | 字符串 | "flux" | 上述表格中的模型名称 |
| width | 整数 | 1024 | 图片宽度(512-2368) |
| height | 整数 | 1024 | 图片高度(512-2368) |
| steps | 整数 | 25 | 生成步数(1-100) |
| guidance_scale | 浮点数 | 3.0 | 引导系数(0-24) |
| seed | 字符串 | None | 用于结果复现的随机种子 |
| webhook_url | 字符串 | None | 用于接收完成通知的URL |
Credits
致谢
Thanks to Claude Opus 4.5 for researching the correct API structure. The docs incorrectly suggest but the working endpoint is .
/v1/images/flux/generate/image/bfl/flux-1-dev感谢Claude Opus 4.5协助研究正确的API结构。官方文档错误地建议使用,而实际可用的接口地址是。
/v1/images/flux/generate/image/bfl/flux-1-dev