name: imagerouter
description: 使用 ImageRouter API 生成 AI 图像(需要 API 密钥)。
homepage: https://imagerouter.io
metadata: {"clawdbot":{"emoji":"🎨","requires":{"bins":["curl"]}}}
使用 curl 命令,通过 ImageRouter 上的任意可用模型生成图像。
test/test 模型是一个用于测试 API 的免费虚拟模型,并非真实模型,因此生成图像时应使用其他模型。
获取最受欢迎的 10 个模型:
curl -X POST 'https://backend.imagerouter.io/operations/get-popular-models'
按名称搜索可用模型:
curl "https://api.imagerouter.io/v1/models?type=image&sort=date&name=gemini"
获取所有可用模型:
curl "https://api.imagerouter.io/v1/models?type=image&sort=date&limit=1000"
使用 JSON 端点进行基本生成:
curl 'https://api.imagerouter.io/v1/openai/images/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{
"prompt": "日落时宁静的山景",
"model": "test/test",
"quality": "auto",
"size": "auto",
"response_format": "url",
"output_format": "webp"
}'
curl 'https://api.imagerouter.io/v1/openai/images/edits' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'prompt=夜晚的赛博朋克城市' \
-F 'model=test/test' \
-F 'quality=high' \
-F 'size=1024x1024' \
-F 'response_format=url' \
-F 'output_format=webp'
curl 'https://api.imagerouter.io/v1/openai/images/edits' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'prompt=将其转换为水彩画' \
-F 'model=test/test' \
-F 'quality=auto' \
-F 'size=auto' \
-F 'response_format=url' \
-F 'output_format=webp' \
-F 'image[]=@/path/to/your/image.webp'
curl 'https://api.imagerouter.io/v1/openai/images/edits' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'prompt=组合这些图像' \
-F 'model=test/test' \
-F 'image[]=@image1.webp' \
-F 'image[]=@image2.webp' \
-F 'image[]=@image3.webp'
curl 'https://api.imagerouter.io/v1/openai/images/edits' \
-H 'Authorization: Bearer YOUR_API_KEY' \
-F 'prompt=用花朵填充蒙版区域' \
-F 'model=test/test' \
-F 'image[]=@original.webp' \
-F 'mask[]=@mask.webp'
auto(默认)、low、medium、highauto(默认)或 宽度x高度(例如 1024x1024)。url(默认)- 返回托管 URLb64_json - 返回 base64 编码的图像b64_ephemeral - Base64 编码,但不保存到日志webp(默认)、jpeg、png{
"created": 1769286389027,
"data": [
{
"url": "https://storage.imagerouter.io/fffb4426-efbd-4bcc-87d5-47e6936bf0bb.webp"
}
],
"latency": 6942,
"cost": 0.004
}
| 功能 | 统一端点 (/edits) | JSON 端点 (/generations) |
|---|---|---|
| 文生图 | ✅ | ✅ |
| 图生图 | ✅ | ❌ |
| 编码方式 | multipart/form-data | application/json |
/v1/openai/images/generations 和 /v1/openai/images/edits 对于统一端点功能相同curl 'https://api.imagerouter.io/v1/openai/images/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{"prompt":"测试图像","model":"test/test"}'
curl 'https://api.imagerouter.io/v1/openai/images/generations' \
-H 'Authorization: Bearer YOUR_API_KEY' \
--json '{"prompt":"抽象艺术","model":"test/test"}' \
| jq -r '.data[0].url' \
| xargs curl -o output.webp