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

# flux-1-kontext-pro

> 使用 FLUX.1 Kontext [pro] 根据文字描述生成图片。接口为同步调用，直接返回 Base64 编码的图片数据。



## OpenAPI

````yaml zh/api-reference/model-api/blackforestlabs/openapi/flux-1-kontext-pro/openapi.yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: FLUX.1 Kontext [pro]
  description: 通过 Anyfast API 调用 Black Forest Labs FLUX.1 Kontext [pro] 文生图模型
  version: 1.0.0
servers:
  - url: https://www.anyfast.ai
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: 文生图
      description: 使用 FLUX.1 Kontext [pro] 根据文字描述生成图片。接口为同步调用，直接返回 Base64 编码的图片数据。
      operationId: createFlux1KontextProTextToImage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  enum:
                    - flux-1-kontext-pro
                  description: 模型 ID
                  example: flux-1-kontext-pro
                prompt:
                  type: string
                  description: 图片描述。必须为英文。
                  example: A cute baby polar bear
                'n':
                  type: integer
                  minimum: 1
                  maximum: 1
                  default: 1
                  description: 生成图片数量。仅支持 1。
                size:
                  type: string
                  description: 输出图片尺寸，如 `1024x1024`。
                  example: 1024x1024
                output_format:
                  type: string
                  enum:
                    - jpeg
                    - png
                  description: 输出图片格式。
                seed:
                  type: integer
                  description: 随机种子，用于复现生成结果。
      responses:
        '200':
          description: 图片生成成功
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
        '400':
          description: 请求无效
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: 未授权
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: 超出速率限制
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ImageGenerationResponse:
      type: object
      properties:
        created:
          type: integer
          description: Unix 时间戳
          example: 1774002799
        data:
          type: array
          items:
            type: object
            properties:
              b64_json:
                type: string
                description: Base64 编码的图片数据。
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````