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

# Create image

> This endpoint processes requests to generate images using AI models by forwarding them
to the appropriate AI node. The request metadata and compute units have already been
validated by middleware before reaching this handler.

## Errors
* Returns various status codes based on the underlying `handle_image_generation_response`:
  - `INTERNAL_SERVER_ERROR` - If there's an error communicating with the AI node



## OpenAPI

````yaml cloud-api-reference/openapi.yml post /v1/images/generations
openapi: 3.1.0
info:
  title: atoma-proxy
  description: ''
  license:
    name: Apache-2.0
    identifier: Apache-2.0
  version: 0.1.0
servers:
  - url: https://api.atoma.network
security: []
tags:
  - name: Completions
    description: OpenAI's API completions v1 endpoint
  - name: Confidential Completions
    description: Atoma's API confidential completions v1 endpoint
  - name: Chat
    description: OpenAI's API chat completions v1 endpoint
  - name: Confidential Chat
    description: Atoma's API confidential chat completions v1 endpoint
  - name: Confidential Embeddings
    description: Atoma's API confidential embeddings v1 endpoint
  - name: Confidential Images
    description: Atoma's API confidential images v1 endpoint
  - name: Embeddings
    description: OpenAI's API embeddings v1 endpoint
  - name: Health
    description: Health check
  - name: Images
    description: OpenAI's API images v1 endpoint
  - name: Models
    description: OpenAI's API models v1 endpoint
  - name: Nodes
    description: Nodes Management
  - name: Node Public Key Selection
    description: Node public key selection
paths:
  /v1/images/generations:
    post:
      tags:
        - Images
      summary: Create image
      description: >-
        This endpoint processes requests to generate images using AI models by
        forwarding them

        to the appropriate AI node. The request metadata and compute units have
        already been

        validated by middleware before reaching this handler.


        ## Errors

        * Returns various status codes based on the underlying
        `handle_image_generation_response`:
          - `INTERNAL_SERVER_ERROR` - If there's an error communicating with the AI node
      operationId: image_generations_create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateImageRequest'
        required: true
      responses:
        '200':
          description: Image generations
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateImageResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '500':
          description: Internal server error
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: typescript
          label: image_generations_create
          source: |-
            import { AtomaSDK } from "atoma-sdk";

            const atomaSDK = new AtomaSDK({
              bearerAuth: process.env["ATOMASDK_BEARER_AUTH"] ?? "",
            });

            async function run() {
              const result = await atomaSDK.images.generate({
                model: "black-forest-labs/FLUX.1-schnell",
                prompt: "A cute baby sea otter",
                n: 1,
                size: "1024x1024"
              });

              // Handle the result
              console.log(result);
            }

            run();
        - lang: python
          label: image_generations_create
          source: |-
            from atoma_sdk import AtomaSDK
            import os

            with AtomaSDK(
                bearer_auth=os.getenv("ATOMASDK_BEARER_AUTH", ""),
            ) as atoma_sdk:

                res = atoma_sdk.images.generate(
                  model="black-forest-labs/FLUX.1-schnell",
                  prompt="A cute baby sea otter floating on its back",
                  n=1,
                  quality="hd",
                  response_format="url",
                  size="1024x1024"
                )

                print(res)
components:
  schemas:
    CreateImageRequest:
      type: object
      description: Request body for image generation
      required:
        - prompt
        - model
      properties:
        model:
          type: string
          description: The model to use for image generation.
          example: black-forest-labs/FLUX.1-schnell
        'n':
          type:
            - integer
            - 'null'
          format: int32
          description: The number of images to generate. Defaults to 1.
          example: 1
          minimum: 0
        prompt:
          type: string
          description: >-
            A text description of the desired image(s). The maximum length is
            1000 characters.
          example: A cute baby sea otter floating on its back
        quality:
          type:
            - string
            - 'null'
          description: >-
            The quality of the image that will be generated.

            `hd` creates images with finer details and greater consistency
            across the image.
          example: hd
        response_format:
          type:
            - string
            - 'null'
          description: The format in which the generated images are returned.
          example: url
        size:
          type:
            - string
            - 'null'
          description: The size of the generated images.
          example: 1024x1024
        style:
          type:
            - string
            - 'null'
          description: The style of the generated images.
          example: vivid
        user:
          type:
            - string
            - 'null'
          description: >-
            A unique identifier representing your end-user, which can help
            OpenAI to monitor and detect abuse.
          example: user-1234
    CreateImageResponse:
      type: object
      description: Response format for image generation
      required:
        - created
        - data
      properties:
        created:
          type: integer
          format: int64
          example: 1677649420
        data:
          type: array
          items:
            $ref: '#/components/schemas/ImageData'
    ImageData:
      type: object
      description: Individual image data in the response
      required:
        - url
      properties:
        revised_prompt:
          type:
            - string
            - 'null'
          example: >-
            A stunning image of a baby sea otter floating on its back in crystal
            clear blue water, with gentle ripples surrounding it. The otter's
            fur appears soft and well-detailed, and its expression is peaceful
            and content.
        url:
          type: string
          example: https://oaidalleapiprodscus.blob.core.windows.net/private/image.png
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````