返回模型列表
FLUX.1 Kontext Dev
black-forest-labsblack-forest-labs/flux-kontext-dev
Open-weight 12B variant of FLUX.1 Kontext. Cheapest entry point for image editing. Routed via SiliconFlow.
上下文长度
--
最大输出
--
图片价格每百万 tokens
$0.018每张图片
输入价格每百万 tokens
$0.0168每百万 Tokens
模态能力
文本图像→图像
价格明细
| 类型 | 费率 |
|---|---|
| 图片 | $0.018 每张图片 |
| 输入 | $0.0168 每百万 Tokens |
| Per image | $0.018 每张图片 |
Per-image flat fee on SiliconFlow
支持参数
promptsizeimageseed
API 使用示例
所有新集成都应使用下方示例中的全球端点 api.therouter.ai;旧中国加速端点已下线。
建议使用异步 API
图像生成通常需要 30–180 秒,超过同步请求的边缘超时。下方示例已使用 ?async=true + 轮询模式。 查看异步图像生成 / 编辑完整指南 →
cURL
# 1) Submit job (returns 202 immediately with a polling URL).
# Image generation takes 30-180s — always use the async path in production.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/generations?async=true" -H "Content-Type: application/json" -H "Authorization: Bearer $THE_ROUTER_API_KEY" -d '{
"model": "black-forest-labs/flux-kontext-dev",
"prompt": "A cinematic product render with soft studio lighting"
}' | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"
# 2) Poll until terminal (succeeded / failed / cancelled / expired).
while :; do
R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB" -H "Authorization: Bearer $THE_ROUTER_API_KEY")
S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
echo "status: $S"
case "$S" in
succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
failed|cancelled|expired) echo "$R"; exit 1 ;;
esac
sleep 5
done图像编辑示例
上传一张图片并用文本 prompt 描述编辑要求;模型会返回编辑后的图片(base64)。
cURL
# Same async submit + poll pattern as /v1/images/generations.
JOB=$(curl -s -X POST "https://api.therouter.ai/v1/images/edits?async=true" -H "Authorization: Bearer $THE_ROUTER_API_KEY" -F "model=black-forest-labs/flux-kontext-dev" -F "prompt=Turn this scene into a watercolor painting" -F "size=1024x1024" -F "image=@input.png" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
echo "submitted: $JOB"
while :; do
R=$(curl -s "https://api.therouter.ai/v1/jobs/$JOB" -H "Authorization: Bearer $THE_ROUTER_API_KEY")
S=$(echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['status'])")
echo "status: $S"
case "$S" in
succeeded) echo "$R" | python3 -c "import sys,json;print(json.load(sys.stdin)['unsigned_urls'][0])"; break ;;
failed|cancelled|expired) echo "$R"; exit 1 ;;
esac
sleep 5
done