Flux-2
Flux-2 模型通过一个统一的异步任务 API 调用。用 POST /api/generate 发起任务,再轮询 GET /api/generate/{taskId} 直到完成。本系列提供 4 个端点。
概览
每个端点共享相同的外层结构 —— 只有 model 和 input 字段不同。可在模型市场的 playground 中运行任意一个。
认证
在 /api-keys 创建 API 密钥,然后作为 Bearer token 发送。已登录时从浏览器发起的请求也可通过会话 cookie 生效。
Authorization: Bearer <YOUR_API_KEY>创建任务
POST https://api.lithovas.com/api/generate请求体:{ "model": "<slug>", "input": { … } }
响应:{ "taskId": "<id>", "state": "waiting" }
查询结果
GET https://api.lithovas.com/api/generate/<taskId>响应:{ "taskId", "state": "waiting" | "success" | "fail", "resultUrls": [ … ], "creditsConsumed", "failMsg", "balance" }
state 变为 success 或 fail。失败任务不计费。端点
Pro · Image to Image
flux2/pro-image-to-imageinput_urlsarray<string>必填Reference images (1-8), max 10MB each, JPEG/PNG/WebP formats
promptstring必填Text description (3-5000 characters) guiding the generation
aspect_ratiostring必填Output image proportions; 'auto' matches first input image
resolutionstring必填Output image resolution level
nsfw_checkerboolean可选Content filtering toggle; false disables safety filtering
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux2/pro-image-to-image",
"input": {
"input_urls": [
"https://example.com/file"
],
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"aspect_ratio": "1:1",
"resolution": "1K",
"nsfw_checker": false
}
}'Pro · Text to Image
flux2/pro-text-to-imagepromptstring必填Generation prompt, must be between 3 and 5000 characters
aspect_ratioenum<string>必填Aspect ratio for generated image
resolutionenum<string>必填Output image resolution
nsfw_checkerboolean可选Disable content filtering when set to false
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux2/pro-text-to-image",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"aspect_ratio": "1:1",
"resolution": "1K",
"nsfw_checker": false
}
}'Flex · Image to Image
flux2/flex-image-to-imageinput_urlsarray<string>必填Input reference images (1-8), file URLs after upload
promptstring必填Text description of desired modifications; 3-5000 characters
aspect_ratioenum<string>必填Output image aspect ratio; auto matches first input
resolutionenum<string>必填Output image resolution
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux2/flex-image-to-image",
"input": {
"input_urls": [
"https://example.com/file"
],
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'Flex · Text to Image
flux2/flex-text-to-imagepromptstring必填Generation prompt, length must be between 3-5000 characters
aspect_ratioenum<string>必填Aspect ratio of the generated image
resolutionenum<string>必填Output image resolution
nsfw_checkerboolean可选Disable content filtering when set to false
curl -X POST https://api.lithovas.com/api/generate \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "flux2/flex-text-to-image",
"input": {
"prompt": "A cinematic red panda surfing through neon rain at dusk.",
"aspect_ratio": "1:1",
"resolution": "1K",
"nsfw_checker": false
}
}'