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

# Create image from text - Classic fast

> Convert descriptive text input into images using AI. This endpoint accepts a variety of parameters to customize the generated images.



## OpenAPI

````yaml post /v1/ai/text-to-image
openapi: 3.0.0
info:
  description: >-
    The Magnific API is your gateway to a vast collection of high-quality
    digital resources for your applications and projects. As a leading platform,
    it offers a wide range of graphics, including vectors, photos,
    illustrations, icons, PSD templates, and more, all curated by talented
    designers from around the world.
  title: Magnific API
  version: 1.0.0
servers:
  - description: B2B API Production V1
    url: https://api.magnific.com
security:
  - magnificApiKey: []
paths:
  /v1/ai/text-to-image:
    post:
      tags:
        - text-to-image
      summary: Create image from text - Classic fast
      description: >-
        Convert descriptive text input into images using AI. This endpoint
        accepts a variety of parameters to customize the generated images.
      operationId: create_image_from_text_classic
      requestBody:
        content:
          application/json:
            examples:
              all-params:
                $ref: '#/components/examples/request-tti-all-params'
              required-params:
                $ref: '#/components/examples/request-tti-required-params'
              portrait-image-size:
                $ref: '#/components/examples/request-tti-portrait-image-size'
              styling-params:
                $ref: '#/components/examples/request-tti-styling-params'
            schema:
              $ref: '#/components/schemas/request-content'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/create_image_from_text_classic_200_response
          description: >-
            OK - The request has succeeded, and the images generated from the
            text are returned.
        '400':
          content:
            application/json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Parameter 'page' must be greater than 0
                invalid_query:
                  summary: Parameter 'query' is not valid
                  value:
                    message: Parameter 'query' must not be empty
                invalid_filter:
                  summary: Parameter 'filter' is not valid
                  value:
                    message: Parameter 'filter' is not valid
                generic_bad_request:
                  summary: Bad Request
                  value:
                    message: Parameter ':attribute' is not valid
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
            application/problem+json:
              examples:
                invalid_page:
                  summary: Parameter 'page' is not valid
                  value:
                    message: Validation error
                    invalid_params:
                      - field: page
                        reason: Parameter 'page' must be greater than 0
                      - field: per_page
                        reason: Parameter 'per_page' must be greater than 0
              schema:
                $ref: >-
                  #/components/schemas/get_all_style_transfer_tasks_400_response_1
          description: >-
            Bad Request - The server could not understand the request due to
            invalid syntax.
        '401':
          content:
            application/json:
              examples:
                invalid_api_key:
                  summary: API key is not valid
                  value:
                    message: Invalid API key
                missing_api_key:
                  summary: API key is not provided
                  value:
                    message: Missing API key
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_400_response'
          description: >-
            Unauthorized - The client must authenticate itself to get the
            requested response.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_500_response'
          description: >-
            Internal Server Error - The server has encountered a situation it
            doesn't know how to handle.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/get_all_style_transfer_tasks_503_response'
          description: Service Unavailable
components:
  examples:
    request-tti-all-params:
      summary: Request - Text to image all params
      value:
        prompt: Crazy dog in the space
        negative_prompt: b&w, earth, cartoon, ugly
        guidance_scale: 2
        seed: 42
        num_images: 1
        image:
          size: square_1_1
        styling:
          style: anime
          effects:
            color: pastel
            lightning: warm
            framing: portrait
          colors:
            - color: '#FF5733'
              weight: 1
            - color: '#33FF57'
              weight: 1
        filter_nsfw: true
    request-tti-required-params:
      summary: Request - Text to image required params
      value:
        prompt: Crazy dog in the space
    request-tti-portrait-image-size:
      summary: Request - Generate image using one of the fixed sizes
      value:
        prompt: Crazy dog in the space
        image:
          size: portrait_2_3
    request-tti-styling-params:
      summary: Request - Generate image with custom styling
      value:
        prompt: Crazy dog in the space
        styling:
          style: anime
          effects:
            color: pastel
            lightning: warm
            framing: portrait
          colors:
            - color: '#FF5733'
              weight: 1
  schemas:
    request-content:
      properties:
        prompt:
          description: |
            Text to generate image from
            Minimum length: `3 characters`
          example: Crazy dog flying over the space
          minLength: 3
          type: string
        negative_prompt:
          description: |
            Attributes to avoid in the generated image
            Minimum length: `3 characters`
          example: b&w, grayscale, disfigured, bad quality
          minLength: 3
          type: string
        styling:
          $ref: '#/components/schemas/request_content_styling'
        guidance_scale:
          default: 1
          description: >
            Defines the level of fidelity to the prompt when generating the
            image. A lower value allows for more creativity from the AI, while a
            higher value ensures closer adherence to the prompt.

            Valid values range `[0.0, 2.0]`, default `1.0`.
          example: 2
          maximum: 2
          minimum: 0
          type: number
        image:
          $ref: '#/components/schemas/image_size'
        num_images:
          default: 1
          description: |
            Specifies the number of images to generate in a single request.
            Valid values range `[1, 4]`, default `1`.
          example: 1
          maximum: 4
          minimum: 1
          type: integer
        seed:
          description: >
            Seed value for image generation. Using the same seed will produce
            the same image. If omitted, random seed will be applied, resulting
            in a different image each time.

            Valid values range `[0, 1000000]`.
          example: 123
          maximum: 1000000
          minimum: 0
          type: integer
        filter_nsfw:
          description: >
            If true, the generated image will be filtered for NSFW content. If
            false, the image may contain NSFW content.

            Default value is `true`.
          example: true
          type: boolean
      required:
        - prompt
      type: object
    create_image_from_text_classic_200_response:
      example:
        data:
          - base64: >-
              iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...
            has_nsfw: false
          - base64: >-
              iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...
            has_nsfw: false
        meta:
          prompt: Crazy dog flying over the space
          seed: 42
          num_inference_steps: 8
          guidance_scale: 2
          image:
            size: square_1_1
            width: 1024
            height: 1024
      properties:
        data:
          items:
            $ref: '#/components/schemas/image'
          type: array
        meta:
          $ref: '#/components/schemas/meta'
      required:
        - data
        - meta
      type: object
    get_all_style_transfer_tasks_400_response:
      example:
        message: message
      properties:
        message:
          type: string
      type: object
    get_all_style_transfer_tasks_400_response_1:
      properties:
        problem:
          $ref: >-
            #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem
      type: object
    get_all_style_transfer_tasks_500_response:
      example:
        message: Internal Server Error
      properties:
        message:
          example: Internal Server Error
          type: string
      type: object
    get_all_style_transfer_tasks_503_response:
      example:
        message: Service Unavailable. Please try again later.
      properties:
        message:
          example: Service Unavailable. Please try again later.
          type: string
      type: object
    request_content_styling:
      properties:
        style:
          description: Style to apply to the image
          enum:
            - photo
            - digital-art
            - 3d
            - painting
            - low-poly
            - pixel-art
            - anime
            - cyberpunk
            - comic
            - vintage
            - cartoon
            - vector
            - studio-shot
            - dark
            - sketch
            - mockup
            - 2000s-pone
            - 70s-vibe
            - watercolor
            - art-nouveau
            - origami
            - surreal
            - fantasy
            - traditional-japan
          example: cartoon
          type: string
        colors:
          description: Dominant colors to generate the image
          items:
            $ref: '#/components/schemas/colors_palette_inner'
          maxItems: 5
          minItems: 1
          type: array
        effects:
          $ref: '#/components/schemas/request_content_styling_effects'
      type: object
    image_size:
      properties:
        size:
          $ref: '#/components/schemas/aspect_ratio'
      required:
        - size
      type: object
    image:
      example:
        base64: >-
          iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...
        has_nsfw: false
      properties:
        base64:
          description: Base64 encoded image
          example: >-
            iVBORw0KGgoAAAANSUhEUgAAASwAAAEsAQAAAABRBrPYAAABrElEQVR4nO3BMQEAAADCoPVPbQ0Po...
          format: base64
          type: string
        has_nsfw:
          description: True if the image has No Safe For Work content, false otherwise
          example: false
          type: boolean
      required:
        - base64
        - has_nsfw
      type: object
    meta:
      example:
        prompt: Crazy dog flying over the space
        seed: 42
        num_inference_steps: 8
        guidance_scale: 2
        image:
          size: square_1_1
          width: 1024
          height: 1024
      properties:
        prompt:
          description: Prompt given to generate the image
          example: Crazy dog flying over the space
          type: string
        seed:
          description: >
            The seed value used to generate the image. Providing the same seed
            will result in the same image being

            generated. If omitted, random seed will be applied, producing a
            different image each time.

            Valid values range `[0, 1000000]`.
          example: 42
          maximum: 1000000
          minimum: 0
          type: integer
        num_inference_steps:
          default: 8
          description: >
            Number of inference steps, higher values will generate more
            realistic images but will take longer to generate.

            Valid values range `[1, 8]`, default `8`
          example: 8
          maximum: 8
          minimum: 1
          type: integer
        guidance_scale:
          default: 1
          description: >
            Defines the level of fidelity to the prompt we give to the image,
            the lower the level, the greater the creativity of the AI.

            Valid values range `[0.0, 2.0]`, default `1.0`
          example: 2
          maximum: 2
          minimum: 0
          type: number
        image:
          $ref: '#/components/schemas/meta_image'
      required:
        - guidance_scale
        - image
        - prompt
        - seed
      type: object
    get_all_style_transfer_tasks_400_response_1_problem:
      properties:
        message:
          example: Validation error
          type: string
        invalid_params:
          items:
            $ref: >-
              #/components/schemas/get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner
          type: array
      required:
        - invalid_params
        - message
      type: object
    colors_palette_inner:
      properties:
        color:
          description: Hex color code
          example: '#FF0000'
          pattern: ^#[0-9A-F]{6}$
          type: string
        weight:
          description: Weight of the color (0.05 to 1)
          example: 0.5
          maximum: 1
          minimum: 0.05
          type: number
      required:
        - color
        - weight
      type: object
    request_content_styling_effects:
      properties:
        color:
          description: Effects - Color to apply to the image
          enum:
            - b&w
            - pastel
            - sepia
            - dramatic
            - vibrant
            - orange&teal
            - film-filter
            - split
            - electric
            - pastel-pink
            - gold-glow
            - autumn
            - muted-green
            - deep-teal
            - duotone
            - terracotta&teal
            - red&blue
            - cold-neon
            - burgundy&blue
          example: b&w
          type: string
        lightning:
          description: Effects - Lightning to apply to the image
          enum:
            - studio
            - warm
            - cinematic
            - volumetric
            - golden-hour
            - long-exposure
            - cold
            - iridescent
            - dramatic
            - hardlight
            - redscale
            - indoor-light
          example: warm
          type: string
        framing:
          description: Effects - Framing to apply to the image
          enum:
            - portrait
            - macro
            - panoramic
            - aerial-view
            - close-up
            - cinematic
            - high-angle
            - low-angle
            - symmetry
            - fish-eye
            - first-person
          example: portrait
          type: string
      type: object
    aspect_ratio:
      default: square_1_1
      description: >
        Image size with the aspect ratio. The aspect ratio is the proportional
        relationship between an image's width and height, expressed as
        *_width_height (e.g., square_1_1, widescreen_16_9). It is calculated by
        dividing the width by the height.\

        If not present, the default is `square_1_1`.

        Note: For the `fluid` model, only this values are valid:

        * square_1_1

        * social_story_9_16

        * widescreen_16_9

        * traditional_3_4

        * classic_4_3
      enum:
        - square_1_1
        - classic_4_3
        - traditional_3_4
        - widescreen_16_9
        - social_story_9_16
        - smartphone_horizontal_20_9
        - smartphone_vertical_9_20
        - standard_3_2
        - portrait_2_3
        - horizontal_2_1
        - vertical_1_2
        - social_5_4
        - social_post_4_5
      example: square_1_1
      type: string
    meta_image:
      allOf:
        - $ref: '#/components/schemas/image_size'
        - properties:
            width:
              description: |
                Image width. If not present, default is `1024`.
                Valid values range `[1, 1792]`
              example: 1024
              maximum: 1792
              minimum: 1
              type: integer
            height:
              description: Image height
              example: 1024
              maximum: 1792
              minimum: 1
              type: integer
          required:
            - height
            - width
          type: object
      example:
        size: square_1_1
        width: 1024
        height: 1024
    get_all_style_transfer_tasks_400_response_1_problem_invalid_params_inner:
      properties:
        name:
          description: Name of the invalid parameter.
          example: page
          type: string
        field:
          description: Field of the invalid parameter. Mirrors `name`.
          example: page
          type: string
        reason:
          example: Parameter 'page' must be greater than 0
          type: string
      required:
        - field
        - name
        - reason
      type: object
  securitySchemes:
    magnificApiKey:
      description: >
        Your Magnific API key. Required for authentication. [Learn how to obtain
        an API key](https://docs.magnific.com/quickstart)
      in: header
      name: x-magnific-api-key
      type: apiKey

````