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

# flux-2-flex

> Generate an image from a text description with FLUX.2 [flex]. Offers fine control over sampling steps and guidance. This is a synchronous call and returns Base64-encoded image data directly.



## OpenAPI

````yaml en/api-reference/model-api/blackforestlabs/openapi/flux-2-flex/openapi.yaml POST /v1/images/generations
openapi: 3.1.0
info:
  title: FLUX.2 [flex]
  description: Call the Black Forest Labs FLUX.2 [flex] text-to-image model
  version: 1.0.0
servers:
  - url: https://ai.cubeuaeai.com
security:
  - bearerAuth: []
paths:
  /v1/images/generations:
    post:
      summary: Generate an image
      description: >-
        Generate an image from a text description with FLUX.2 [flex]. Offers
        fine control over sampling steps and guidance. This is a synchronous
        call and returns Base64 -encoded image data.
      operationId: createFlux2Flex
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - model
                - prompt
              properties:
                model:
                  type: string
                  enum:
                    - flux-2-flex
                  description: model ID
                  example: flux-2-flex
                prompt:
                  type: string
                  description: Image description text.
                  example: An adorable polar bear cub
                'n':
                  type: integer
                  minimum: 1
                  maximum: 4
                  default: 1
                  description: Number of images to generate.
                size:
                  type: string
                  description: Output image size, e.g. `1024x1024`. Supports up to 4MP.
                  example: 1024x1024
                inference_steps:
                  type: integer
                  minimum: 1
                  maximum: 50
                  description: >-
                    Sampling steps. Low values (6–20) are for fast prototypes;
                    high values (40–50) are for maximum fidelity.
                guidance_scale:
                  type: number
                  minimum: 1.5
                  maximum: 10
                  description: >-
                    Guidance scale. Controls how closely the model follows the
                    prompt. Higher values stay more faithful to the prompt.
                output_format:
                  type: string
                  enum:
                    - jpeg
                    - png
                  description: Output image format.
                  example: jpeg
                seed:
                  type: integer
                  description: Random seed, used to reproduce generation results.
      responses:
        '200':
          description: Image generated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  created:
                    type: integer
                    description: Creation timestamp
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        b64_json:
                          type: string
                          description: Base64-encoded image data.
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````