KIE.AI
Chinese
  • English
  • Chinese
Chinese
  • English
  • Chinese
Support
Chinese
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
  1. Flux Kontext API
  • Flux Kontext API 快速开始
  • 图像生成或编辑回调
  • 生成或编辑图像
    POST
  • 获取图像详情
    GET
Chinese
  • English
  • Chinese
Support
Chinese
  • English
  • Chinese
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
MarketVeo3.1 APISuno API4o Image APIFlux Kontext API
Runway APILuma APIFile Upload APICommon API
  1. Flux Kontext API

生成或编辑图像

POST
/api/v1/flux/kontext/generate
使用 Flux Kontext AI 模型创建新的图像生成或编辑任务。

使用模式#

1.
文本到图像生成
提供 prompt 和 aspectRatio
模型将根据文本描述生成新图像
2.
图像编辑
提供 prompt 和 inputImage
您可以选择性地提供 aspectRatio。
如果提供,输出将被裁剪或填充以匹配此比例。
如果省略,将保持原始图像的比例。
模型将根据提示编辑输入图像

重要说明#

生成的图像将在14天后过期
提示仅支持英文
根据您的需求选择合适的模型:
flux-kontext-pro:适用于大多数用例的标准模型
flux-kontext-max:适用于复杂场景的增强模型

Callbacks

onImageGenerated

Request

Authorization
Bearer Token
Provide your bearer token in the
Authorization
header when making requests to protected resources.
Example:
Authorization: Bearer ********************
or
Body Params application/jsonRequired

Examples

Responses

🟢200
application/json
请求成功
Body

🔴500Error
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.kie.ai/api/v1/flux/kontext/generate' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "prompt": "A serene mountain landscape at sunset with a lake reflecting the orange sky",
    "enableTranslation": true,
    "aspectRatio": "16:9",
    "outputFormat": "jpeg",
    "promptUpsampling": false,
    "model": "flux-kontext-pro"
}'
Response Response Example
200 - 成功示例
{
    "code": 200,
    "msg": "success",
    "data": {
        "taskId": "task12345"
    }
}
Previous
图像生成或编辑回调
Next
获取图像详情
Built with