Flux 3 API 接入文档
使用 VezAPI 密钥接入 Flux 3。下列操作共用同一个账号余额和鉴权方式。
https://api.vezapi.com请求头使用 Authorization: Bearer YOUR_VEZAPI_KEY。每次提交使用唯一的 Idempotency-Key,查询同一笔提交时才复用。
FLUX 3 Klein 图像编辑
/api/v1/jobs/createTask模型标识: flux-3/klein-edit-image
| 参数 | 类型 | 说明与限制 |
|---|---|---|
model必填 | string | 用于生成的模型名称。此端点必须使用 `flux-3/klein-edit-image`。 可选值: 默认: |
callBackUrl可选 | string | 接收生成任务完成更新的 URL。可选,但建议在生产环境中使用。生成完成时系统会向此 URL POST 任务状态和结果。 为确保回调安全,请参阅 [Webhook 校验指南](/cn/common-api/webhook-verification)。 |
input必填 | object | 生成任务的输入参数 |
input.prompt必填 | string | 描述如何修改图像的指令(最大长度:5000 字符)
|
input.image_urls必填 | array | 用于图像变换或作为参考的输入图像(最多支持 10 张图片)(为上传后的文件 URL,非文件内容;支持的类型:image/jpeg、image/png、image/webp;最大文件大小:30.0MB)
|
input.aspect_ratio可选 | string | 生成图像的宽高比。选择 auto 可匹配首张输入图像的比例。 可选值:1:1; 4:3; 3:4; 3:2; 2:3; 16:9; 9:16; 21:9; 9:21; auto 可选值: 默认: |
input.resolution可选 | string | 生成图像的分辨率 可选值:1K; 2K; 4K 可选值: 默认: |
input.width可选 | integer | 生成图像的宽度。必须与 height 同时传入;宽高比需介于 1:2.5 和 2.5:1 之间。一旦传入此参数,aspect_ratio 和 resolution 将被忽略。
|
input.height可选 | integer | 生成图像的高度。必须与 width 同时传入;宽高比需介于 1:2.5 和 2.5:1 之间。一旦传入此参数,aspect_ratio 和 resolution 将被忽略。
|
input.output_format可选 | string | 生成图像的输出格式 可选值:png; jpeg; webp 可选值: 默认: |
input.num_images可选 | integer | 生成图片数量 默认:
|
input.seed可选 | integer | 随机种子
|
input.enhance_prompt可选 | boolean | 出图前先把提示词改写成更完整的描述,能明显提升效果。默认开启(不传该参数也视为开启),传 false 可关闭。文生图与图像编辑都生效;编辑模式下改写会保留原指令的意图。 可选值: 默认: |
input.nsfw_checker可选 | boolean | 默认 false。为 false 时不额外进行内容过滤,结果由模型直接返回。 |
请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-3/klein-edit-image",
"input": {
"prompt": "Your prompt",
"image_urls": [
"Your prompt"
],
"aspect_ratio": "auto",
"resolution": "1K"
}
}'返回值与错误
HTTP 200
请求成功
| 参数 | 类型 | 说明与限制 |
|---|---|---|
code可选 | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). 可选值: |
msg可选 | string | Response message, error description upon failure |
data必填 | object | |
data.taskId必填 | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
FLUX 3 Klein 文生图
/api/v1/jobs/createTask模型标识: flux-3/klein-text-to-image
| 参数 | 类型 | 说明与限制 |
|---|---|---|
model必填 | string | 用于生成的模型名称。此端点必须使用 `flux-3/klein-text-to-image`。 可选值: 默认: |
callBackUrl可选 | string | 接收生成任务完成更新的 URL。可选,但建议在生产环境中使用。生成完成时系统会向此 URL POST 任务状态和结果。 为确保回调安全,请参阅 [Webhook 校验指南](/cn/common-api/webhook-verification)。 |
input必填 | object | 生成任务的输入参数 |
input.prompt必填 | string | 用于描述待生成图像的文本提示词(最大长度:5000 字符)
|
input.aspect_ratio可选 | string | 生成图像的宽高比 可选值:1:1; 4:3; 3:4; 3:2; 2:3; 16:9; 9:16; 21:9; 9:21 可选值: 默认: |
input.resolution可选 | string | 生成图像的分辨率 可选值:1K; 2K; 4K 可选值: 默认: |
input.width可选 | integer | 图像宽度。必须同时传入宽度和高度。宽高比必须介于 1:2.5 和 2.5:1 之间。一旦传入,aspect_ratio 和 resolution 将被忽略。
|
input.height可选 | integer | 图像高度。必须同时传入宽度和高度。宽高比必须介于 1:2.5 和 2.5:1 之间。一旦传入,aspect_ratio 和 resolution 将被忽略。
|
input.output_format可选 | string | 生成图像的输出格式 可选值:png; jpeg; webp 可选值: 默认: |
input.num_images可选 | integer | 生成图片数量 默认:
|
input.seed可选 | integer | 随机种子
|
input.enhance_prompt可选 | boolean | 出图前先把提示词改写成更完整的描述,能明显提升效果。默认开启(不传该参数也视为开启),传 false 可关闭。文生图与图像编辑都生效;编辑模式下改写会保留原指令的意图。 可选值: 默认: |
input.nsfw_checker可选 | boolean | 默认 false。为 false 时不额外进行内容过滤,结果由模型直接返回。 |
请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
-H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
-H 'Idempotency-Key: your-unique-request-id' \
-H 'Content-Type: application/json' \
-d '{
"model": "flux-3/klein-text-to-image",
"input": {
"prompt": "Your prompt",
"aspect_ratio": "1:1",
"resolution": "1K"
}
}'返回值与错误
HTTP 200
请求成功
| 参数 | 类型 | 说明与限制 |
|---|---|---|
code可选 | integer | Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying). 可选值: |
msg可选 | string | Response message, error description upon failure |
data必填 | object | |
data.taskId必填 | string | The task ID can be used with the "Get Task Details" endpoint to query the task status. |
任务状态与回调
异步任务请保存返回的 taskId。调用 GET /api/v1/jobs/recordInfo?taskId=... 查询,或在创建时设置 callBackUrl。只有任务所属账号可以查询任务或基于任务创建派生资源。
超时可能表示请求已经受理。请在控制台查看原请求,不要自动新建任务。回调可能重试并重复到达,请使用 X-VezAPI-Event-Id 去重。
文件、日志与计费
生成媒体通常随上游保留 14 天,上传文件在 24 小时后失效。请在过期前保存所需文件。VezAPI 仅流式转发已登记资源,不提供永久作品库。请求日志保留两个自然月。
调用前预留积分,最终按实际优惠扣分 1:1 结算。用量不明时暂停新付费请求。若保护其他任务预留后余额不足以结算,会保留待结算记录,补足余额后再扣费;模型用量不会将钱包扣成负数。按时长计价的输入文件由服务端读取时长,读取失败时不提交模型任务。