模型市场支持← 返回应用

Flux-2

Flux-2 模型通过一个统一的异步任务 API 调用。用 POST /api/generate 发起任务,再轮询 GET /api/generate/{taskId} 直到完成。本系列提供 4 个端点。

概览

每个端点共享相同的外层结构 —— 只有 modelinput 字段不同。可在模型市场的 playground 中运行任意一个。

认证

/api-keys 创建 API 密钥,然后作为 Bearer token 发送。已登录时从浏览器发起的请求也可通过会话 cookie 生效。

Authorization: Bearer <YOUR_API_KEY>

创建任务

POST
POST https://api.lithovas.com/api/generate

请求体:{ "model": "<slug>", "input": { … } }

响应:{ "taskId": "<id>", "state": "waiting" }

查询结果

GET
GET https://api.lithovas.com/api/generate/<taskId>

响应:{ "taskId", "state": "waiting" | "success" | "fail", "resultUrls": [ … ], "creditsConsumed", "failMsg", "balance" }

异步
创建任务返回 200 只表示任务已被接受 —— 并非已完成。请轮询此端点,直到 state 变为 successfail。失败任务不计费。

端点

模型任务model slug
ProImage to Imageflux2/pro-image-to-image
ProText to Imageflux2/pro-text-to-image
FlexImage to Imageflux2/flex-image-to-image
FlexText to Imageflux2/flex-text-to-image

Pro · Image to Image

POSTImage to Imageflux2/pro-image-to-image
input 字段
input_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
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

POSTText to Imageflux2/pro-text-to-image
input 字段
promptstring必填

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
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

POSTImage to Imageflux2/flex-image-to-image
input 字段
input_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
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

POSTText to Imageflux2/flex-text-to-image
input 字段
promptstring必填

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
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
  }
}'