> ## 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 Kontext Image Generation

> Image generation and image editing models powered by Black Forest Labs Flux Kontext

<Tip>
  1. After submission, a `task_id` will be returned. If you provided a `callback_url`, when the task status becomes `finished` or `failed`, a POST request will be sent to the `callback_url`.
  2. Regardless of whether `callback_url` is provided, you can retrieve the response result through the unified [Query Task Status](/api-manual/task-management/status) endpoint.
</Tip>

# Flux Kontext Image Generation

Flux Kontext is powered by Black Forest Labs. It supports both text-to-image generation and image editing through the same unified submit endpoint.

## Available Models

* **flux-kontext-pro** - Flux Kontext Pro text-to-image generation
* **flux-kontext-pro-edit** - Flux Kontext Pro image editing, `image_urls` is required
* **flux-kontext-max** - Flux Kontext Max text-to-image generation
* **flux-kontext-max-edit** - Flux Kontext Max image editing, `image_urls` is required

## Notes

* `size` supports `1:1`, `4:3`, `3:4`, `16:9`, `9:16`, `21:9`, `9:21`
* `output_format` supports `png`, `jpg`
* `image_urls` is required for edit models
* Only `image_urls[0]` is used as the input image
* Other downstream fields are not exposed in the current API and use system defaults
* Credits are charged directly according to the configured model price


## OpenAPI

````yaml /api-manual/image-series/flux-kontext.json POST /api/generate/submit
openapi: 3.0.0
info:
  title: Vidgo API - Flux Kontext API
  description: >-
    Image generation and image editing models powered by Black Forest Labs Flux
    Kontext
  version: 1.0.0
servers:
  - url: https://api.vidgo.ai
    description: Production server
security:
  - BearerAuth: []
paths:
  /api/generate/submit:
    post:
      tags:
        - Flux Kontext
      summary: Submit Flux Kontext Generation Task
      description: >-
        Generate or edit images with Flux Kontext models through the unified
        submit endpoint
      operationId: submitFluxKontextTask
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubmitRequest'
            examples:
              flux-kontext-pro:
                summary: Flux Kontext Pro Image Generation
                value:
                  model: flux-kontext-pro
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: >-
                      A luxury perfume bottle on a reflective marble surface,
                      premium studio lighting
                    size: '16:9'
                    output_format: png
              flux-kontext-pro-edit:
                summary: Flux Kontext Pro Image Edit
                value:
                  model: flux-kontext-pro-edit
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: >-
                      Replace the background with a clean warm gradient studio
                      backdrop
                    image_urls:
                      - https://example.com/reference.jpg
                    size: '1:1'
                    output_format: jpg
              flux-kontext-max:
                summary: Flux Kontext Max Image Generation
                value:
                  model: flux-kontext-max
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: >-
                      A premium wristwatch product photo with dramatic soft
                      shadows and metallic highlights
                    size: '4:3'
                    output_format: png
              flux-kontext-max-edit:
                summary: Flux Kontext Max Image Edit
                value:
                  model: flux-kontext-max-edit
                  callback_url: https://your-domain.com/callback
                  input:
                    prompt: Change the background into a minimal teal studio scene
                    image_urls:
                      - https://example.com/reference.jpg
                    size: '1:1'
                    output_format: jpg
      responses:
        '200':
          description: Task submitted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubmitResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 400
                error:
                  message: Invalid request parameters
                  type: invalid_request_error
        '401':
          description: Unauthorized - Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 401
                error:
                  message: Unauthorized - Invalid API key
                  type: authentication_error
components:
  schemas:
    SubmitRequest:
      type: object
      required:
        - model
        - input
      properties:
        model:
          type: string
          description: Flux Kontext model identifier
          enum:
            - flux-kontext-pro
            - flux-kontext-pro-edit
            - flux-kontext-max
            - flux-kontext-max-edit
        callback_url:
          type: string
          format: uri
          description: Webhook callback URL for result notifications
          example: https://your-domain.com/callback
        input:
          type: object
          required:
            - prompt
          description: Input parameters for generation
          properties:
            prompt:
              type: string
              description: Generation or editing prompt describing the desired output
              maxLength: 2000
              example: A beautiful sunset over the ocean
            image_urls:
              type: array
              items:
                type: string
                format: uri
              minItems: 1
              maxItems: 1
              description: |-
                Input image URLs. Required for edit models
                (flux-kontext-pro-edit, flux-kontext-max-edit). Only the first
                image is used.
              example:
                - https://example.com/reference.jpg
            size:
              type: string
              description: Output aspect ratio. Defaults to 1:1 when omitted.
              enum:
                - '1:1'
                - '4:3'
                - '3:4'
                - '16:9'
                - '9:16'
                - '21:9'
                - '9:21'
              default: '1:1'
              example: '16:9'
            output_format:
              type: string
              description: Output image format.
              enum:
                - png
                - jpg
              example: png
    SubmitResponse:
      type: object
      required:
        - code
        - data
      properties:
        code:
          type: integer
          example: 200
          description: HTTP status code
        data:
          type: object
          required:
            - task_id
            - status
            - created_time
          properties:
            task_id:
              type: string
              example: task-unified-1757165031-uyujaw3d
              description: Unique task identifier for status tracking
            status:
              type: string
              enum:
                - not_started
              example: not_started
              description: Initial task status
            created_time:
              type: string
              format: date-time
              example: '2025-11-12T10:30:00'
              description: ISO 8601 timestamp when the task was created
    ErrorResponse:
      type: object
      required:
        - code
        - error
      properties:
        code:
          type: integer
          example: 400
          description: HTTP status code
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              example: Invalid request parameters
              description: Error message describing what went wrong
            type:
              type: string
              example: invalid_request_error
              description: Error type identifier
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >-
        All API endpoints require Bearer Token authentication


        Get your API Key:


        Visit the [API Key Management
        Page](https://vidgo.ai/apis/dashboard/api-key) to get your API Key


        Add it to the request header:


        ```

        Authorization: Bearer YOUR_API_KEY

        ```

````