> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vidgo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Flux Schnell 文生图

> Flux Schnell 文生图 API 根据提示词快速生成 PNG 或 JPEG 图像，支持预设宽高比、1:1 HD 或自定义 WIDTHxHEIGHT 尺寸，并可一次生成多张。

> [!TIP]
>
> 1. 提交后会返回 `task_id`。如果提供了 `callback_url`，当任务状态变为 `finished` 或 `failed` 时，系统会向 `callback_url` 发送 POST 请求。
> 2. 无论是否提供 `callback_url`，都可以通过统一的[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)接口获取结果。

## 提交任务

向 `POST /api/generate/submit` 发送 `model: "blackforestlabs/flux/schnell"` 和一个 `input` 对象。使用 `Authorization: Bearer VIDGO_API_KEY` 认证。

* `prompt`：必填字符串。描述图像，去除首尾空白后至少一个字符。
* `size`：输出画布，默认 `1:1`。可选 `1:1`、`1:1 HD`、`4:3`、`3:4`、`16:9`、`9:16`，或自定义 `WIDTHxHEIGHT`（如 `1024x1536`）。自定义宽和高为正整数。
* `n`：正整数，指定输出图像数量，默认 `1`。
* `output_format`：`png` 或 `jpeg`，默认 `png`。

## 获取图像

提交响应会返回 `data.task_id`。使用[查询任务状态](https://docs.vidgo.ai/zh/api-manual/task-management/status.md)跟踪任务经过 `not_started`、`running`、`finished` 或 `failed` 等状态。

状态为 `finished` 时，从 `data.files[].file_url` 读取图像 URL。状态为 `failed` 时，读取 `data.error_message`。

可以在顶层提供 `callback_url`，通过 [Webhook](https://docs.vidgo.ai/zh/api-manual/task-management/webhooks.md) 接收最终结果。

## 已验证示例

崖边泳池的第一缕晨光。此文生图示例只使用提示词。

```json theme={null}
{
  "model": "blackforestlabs/flux/schnell",
  "input": {
    "prompt": "An architectural photograph of an empty public seawater swimming pool built into a coastal cliff at sunrise. From a low viewpoint beside the pool, pale turquoise water fills the foreground, broad curved stone steps descend naturally into the shallow end on the right, and a simple white limewashed wall catches moving water reflections. Warm low morning sunlight reveals the rough limestone coping and delicate ripples. Beyond the far pool edge, the calm open sea and a clean level horizon remain clearly visible. Restrained Mediterranean colors, believable pool geometry, natural light, crisp tactile surfaces, peaceful everyday public architecture. One coherent full-frame photograph, no people, hotel styling, advertising, signs, lettering, logos or watermark.",
    "size": "4:3",
    "n": 1,
    "output_format": "png"
  }
}
```

![崖边泳池的第一缕晨光](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux/schnell/text-to-image/v1/01/output.png)


## OpenAPI

````yaml zh/api-manual/image-series/blackforestlabs-flux-schnell.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Flux Schnell 文生图
  description: Flux Schnell 文生图 API。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Flux Schnell
      summary: 提交 Flux Schnell 文生图任务
      operationId: submitFluxSchnellTextToImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              default:
                summary: 崖边泳池的第一缕晨光
                value:
                  model: blackforestlabs/flux/schnell
                  input:
                    prompt: >-
                      An architectural photograph of an empty public seawater
                      swimming pool built into a coastal cliff at sunrise. From
                      a low viewpoint beside the pool, pale turquoise water
                      fills the foreground, broad curved stone steps descend
                      naturally into the shallow end on the right, and a simple
                      white limewashed wall catches moving water reflections.
                      Warm low morning sunlight reveals the rough limestone
                      coping and delicate ripples. Beyond the far pool edge, the
                      calm open sea and a clean level horizon remain clearly
                      visible. Restrained Mediterranean colors, believable pool
                      geometry, natural light, crisp tactile surfaces, peaceful
                      everyday public architecture. One coherent full-frame
                      photograph, no people, hotel styling, advertising, signs,
                      lettering, logos or watermark.
                    size: '4:3'
                    'n': 1
                    output_format: png
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              example:
                code: 200
                data:
                  task_id: RGOGR6Z9UO0KX623
                  status: running
                  created_time: '2026-09-25T11:31:42'
        '400':
          description: 请求参数无效
        '401':
          description: 未授权
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          enum:
            - blackforestlabs/flux/schnell
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook 回调 URL。
        input:
          type: object
          required:
            - prompt
          description: 文生图参数。
          properties:
            prompt:
              type: string
              description: 描述要生成的图像或要做的修改。去除首尾空白后至少一个字符。
              minLength: 1
              example: >-
                An architectural photograph of an empty public seawater swimming
                pool built into a coastal cliff at sunrise. From a low viewpoint
                beside the pool, pale turquoise water fills the foreground,
                broad curved stone steps descend naturally into the shallow end
                on the right, and a simple white limewashed wall catches moving
                water reflections. Warm low morning sunlight reveals the rough
                limestone coping and delicate ripples. Beyond the far pool edge,
                the calm open sea and a clean level horizon remain clearly
                visible. Restrained Mediterranean colors, believable pool
                geometry, natural light, crisp tactile surfaces, peaceful
                everyday public architecture. One coherent full-frame
                photograph, no people, hotel styling, advertising, signs,
                lettering, logos or watermark.
            size:
              type: string
              description: >-
                输出画布。预设：1:1（512×512）、1:1
                HD（1024×1024）、4:3（1024×768）、3:4（768×1024）、16:9（1024×576）、9:16（576×1024）。自定义
                WIDTHxHEIGHT 尺寸为正整数。


                使用预设（`1:1`、`1:1 HD`、`4:3`、`3:4`、`16:9`、`9:16`）或自定义
                `WIDTHxHEIGHT` 尺寸。
              default: '1:1'
              example: '4:3'
            'n':
              type: integer
              description: 输出图像数量。
              default: 1
              example: 1
              minimum: 1
            output_format:
              type: string
              description: 输出图像格式。
              enum:
                - jpeg
                - png
              default: png
              example: png
          additionalProperties: false
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
            status:
              type: string
              enum:
                - not_started
                - running
                - failed
            created_time:
              type: string
              format: date-time
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: '使用 `Authorization: Bearer VIDGO_API_KEY`。'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.