> ## 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 Dev 文生图

> Flux Dev 文生图 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/dev"` 和一个 `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) 接收最终结果。

## 已验证示例

此示例通过 Vidgo 测试 API 生成。源图和结果图托管在 Vidgo CDN 上。

![小提琴修复师](https://cdn.vidgo.ai/apis/models/blackforestlabs/flux/dev/v1/01/output.png)

```json theme={null}
{
  "code": 200,
  "data": {
    "task_id": "ZOBDNFN25SVGKU85",
    "status": "finished",
    "files": [
      {
        "file_url": "https://cdn.vidgo.ai/apis/models/blackforestlabs/flux/dev/v1/01/output.png",
        "file_type": "image"
      }
    ],
    "created_time": "2026-09-25T11:20:26",
    "error_message": null,
    "progress": 100
  }
}
```


## OpenAPI

````yaml zh/api-manual/image-series/blackforestlabs-flux-dev.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Flux Dev 文生图
  description: Flux Dev 文生图 API。
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: 生产环境服务器
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Flux Dev
      summary: 提交 Flux Dev 文生图任务
      operationId: submitFluxDevTextToImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              default:
                summary: 小提琴修复师
                value:
                  model: blackforestlabs/flux/dev
                  input:
                    prompt: >-
                      An intimate documentary photograph of an elderly violin
                      restorer in a small lived-in workshop, viewed from
                      slightly above bench height. The craftsman wears a faded
                      indigo work shirt and round spectacles, leaning forward to
                      inspect the curved varnished body of one antique violin
                      resting on a folded linen cloth. One hand steadies the
                      violin gently while the other holds a small inspection
                      light. A large window on the left casts soft directional
                      afternoon daylight across his lined face, amber wood
                      grain, delicate wood shavings, a steel chisel and worn
                      workbench. A few unfinished violin shapes hang softly out
                      of focus in the background. Quiet concentration,
                      believable hands and tools, rich natural material
                      textures, subtle film grain, restrained warm colors, one
                      coherent scene, no staged product display, no lettering,
                      no logos, no watermark.
                    'n': 1
                    output_format: png
                    size: '4:3'
              text-to-image-02:
                summary: 蓝色冰川内部
                value:
                  model: blackforestlabs/flux/dev
                  input:
                    prompt: >-
                      A vertical environmental photograph from deep inside a
                      vast natural blue glacier cave. One small adult explorer
                      wearing a burnt-orange parka, dark trousers and a climbing
                      helmet stands in the lower third on solid textured ice,
                      seen from behind in a stable natural stance. A modest
                      warm-white headlamp illuminates a nearby translucent
                      ridge. Towering curved walls of aquamarine ice sweep
                      upward around the explorer, with intricate trapped bubbles
                      and layered striations visible in the foreground; pale
                      daylight enters through a narrow opening far above. Strong
                      sense of human scale, physically plausible ice
                      translucency, controlled blue and amber color contrast,
                      deep spatial perspective, crisp near textures and gentle
                      distant haze, documentary adventure photography, no text,
                      no logos, no watermark.
                    'n': 1
                    output_format: jpeg
                    size: '3:4'
              text-to-image-03:
                summary: 沙丘上空的云隙光
                value:
                  model: blackforestlabs/flux/dev
                  input:
                    prompt: >-
                      A wide surreal fine-art landscape with a single enormous
                      manta-ray-shaped cloud floating slowly above ochre desert
                      dunes. The ray is made entirely of soft white cloud vapor,
                      with broad gracefully curved wings and a long delicate
                      cloud tail, recognizable as a manta silhouette rather than
                      a solid animal. Late afternoon sunlight gives the vapor
                      luminous edges, while its broad soft shadow falls
                      naturally across the wind-sculpted sand. One tiny solitary
                      traveler in a dark cloak stands on a distant dune ridge at
                      the lower right, emphasizing the vast scale. A pale clear
                      sky, long elegant dune curves, quiet wonder, cinematic
                      depth and carefully balanced negative space, detailed sand
                      ripples in the foreground, no buildings, no vehicles, no
                      typography, no logo, no watermark.
                    'n': 1
                    output_format: png
                    size: '16:9'
      responses:
        '200':
          description: 任务提交成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
              example:
                code: 200
                data:
                  task_id: ZOBDNFN25SVGKU85
                  status: running
                  created_time: '2026-09-25T11:20:26'
        '400':
          description: 请求参数无效
        '401':
          description: 未授权
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      additionalProperties: false
      properties:
        model:
          type: string
          enum:
            - blackforestlabs/flux/dev
        callback_url:
          type: string
          format: uri
          description: 可选的 Webhook 回调 URL。
        input:
          type: object
          required:
            - prompt
          description: 文生图参数。
          properties:
            prompt:
              type: string
              description: 描述要生成的图像或要做的修改。去除首尾空白后至少一个字符。
              minLength: 1
              example: >-
                An intimate documentary photograph of an elderly violin restorer
                in a small lived-in workshop, viewed from slightly above bench
                height. The craftsman wears a faded indigo work shirt and round
                spectacles, leaning forward to inspect the curved varnished body
                of one antique violin resting on a folded linen cloth. One hand
                steadies the violin gently while the other holds a small
                inspection light. A large window on the left casts soft
                directional afternoon daylight across his lined face, amber wood
                grain, delicate wood shavings, a steel chisel and worn
                workbench. A few unfinished violin shapes hang softly out of
                focus in the background. Quiet concentration, believable hands
                and tools, rich natural material textures, subtle film grain,
                restrained warm colors, one coherent scene, no staged product
                display, no lettering, no logos, no 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.