Leonardo.AI Realtime Canvas API

The Realtime Canvas API from Leonardo.AI — 4 operation(s) for realtime canvas.

Documentation

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

leonardo-ai-realtime-canvas-api-openapi.yml Raw ↑
openapi: 3.0.0
info:
  title: Leonardo.AI 3D Model Assets Realtime Canvas API
  description: Upload, retrieve, and delete 3D model assets for use with Rodin and other 3D-capable workflows.
  version: v1.0.0
  contact:
    name: Leonardo.AI Support
    url: https://docs.leonardo.ai/docs/need-more-support
  license:
    name: Leonardo.AI Terms of Service
    url: https://leonardo.ai/terms-of-service/
servers:
- url: https://cloud.leonardo.ai/api/rest/v1
  description: Leonardo.AI Production API
security:
- bearerAuth: []
tags:
- name: Realtime Canvas
paths:
  /generations-lcm:
    post:
      tags:
      - Realtime Canvas
      summary: Create LCM Generation
      description: This endpoint will generate a LCM image generation.
      operationId: createLCMGeneration
      requestBody:
        content:
          application/json:
            schema:
              properties:
                imageDataUrl:
                  nullable: false
                  title: String
                  type: string
                  description: 'Image data used to generate image. In base64 format. Prefix: `data:image/jpeg;base64,`'
                prompt:
                  nullable: false
                  title: String
                  type: string
                  description: The prompt used to generate images
                guidance:
                  nullable: true
                  title: Float
                  type: number
                  description: How strongly the generation should reflect the prompt. Must be a float between 0.5 and 20.
                strength:
                  nullable: true
                  title: Float
                  type: number
                  description: Creativity strength of generation. Higher strength will deviate more from the original image supplied in imageDataUrl. Must be a float between 0.1 and 1.
                requestTimestamp:
                  $ref: '#/components/schemas/timestamp'
                style:
                  $ref: '#/components/schemas/lcm_generation_style'
                steps:
                  nullable: true
                  title: Int
                  type: integer
                  description: The number of steps to use for the generation. Must be between 4 and 16.
                width:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                height:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                seed:
                  $ref: '#/components/schemas/seed'
              type: object
              required:
              - imageDataUrl
              - prompt
        description: Query parameters can also be provided in the request body as a JSON object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  lcmGenerationJob:
                    nullable: true
                    properties:
                      imageDataUrl:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      requestTimestamp:
                        $ref: '#/components/schemas/timestamp'
                      apiCreditCost:
                        $ref: '#/components/schemas/apiCreditCost'
                      cost:
                        $ref: '#/components/schemas/cost'
                    title: LcmGenerationOutput
                    type: object
              example:
                lcmGenerationJob:
                  imageDataUrl:
                  - data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD...
                  requestTimestamp: '1234567890'
                  apiCreditCost: null
                  cost:
                    amount: '0.0147'
                    unit: DOLLARS
          description: Responses for POST /generations-lcm
  /lcm-instant-refine:
    post:
      tags:
      - Realtime Canvas
      summary: Perform instant refine on a LCM image
      description: This endpoint will perform instant refine on a LCM image
      operationId: performInstantRefine
      requestBody:
        content:
          application/json:
            schema:
              properties:
                imageDataUrl:
                  nullable: false
                  title: String
                  type: string
                  description: 'Image data used to generate image. In base64 format. Prefix: `data:image/jpeg;base64,`'
                prompt:
                  nullable: false
                  title: String
                  type: string
                  description: The prompt used to generate images
                guidance:
                  nullable: true
                  title: Float
                  type: number
                  description: How strongly the generation should reflect the prompt. Must be a float between 0.5 and 20.
                strength:
                  nullable: true
                  title: Float
                  type: number
                  description: Creativity strength of generation. Higher strength will deviate more from the original image supplied in imageDataUrl. Must be a float between 0.1 and 1.
                requestTimestamp:
                  $ref: '#/components/schemas/timestamp'
                style:
                  $ref: '#/components/schemas/lcm_generation_style'
                steps:
                  nullable: true
                  title: Int
                  type: integer
                  description: The number of steps to use for the generation. Must be between 4 and 16.
                width:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                height:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                seed:
                  $ref: '#/components/schemas/seed'
              type: object
              required:
              - imageDataUrl
              - prompt
        description: Query parameters can also be provided in the request body as a JSON object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  lcmGenerationJob:
                    nullable: true
                    properties:
                      imageDataUrl:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      requestTimestamp:
                        $ref: '#/components/schemas/timestamp'
                      apiCreditCost:
                        $ref: '#/components/schemas/apiCreditCost'
                      cost:
                        $ref: '#/components/schemas/cost'
                    title: LcmGenerationOutput
                    type: object
              example:
                lcmGenerationJob:
                  imageDataUrl:
                  - data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD...
                  requestTimestamp: '1234567891'
                  apiCreditCost: null
                  cost:
                    amount: '0.0147'
                    unit: DOLLARS
          description: Responses for POST /lcm-instant-refine
  /lcm-inpainting:
    post:
      tags:
      - Realtime Canvas
      summary: Perform inpainting on a LCM image
      description: This endpoint will perform a inpainting on a LCM image
      operationId: performInpaintingLCM
      requestBody:
        content:
          application/json:
            schema:
              properties:
                imageDataUrl:
                  nullable: false
                  title: String
                  type: string
                  description: 'Image data used to generate image. In base64 format. Prefix: `data:image/jpeg;base64,`'
                maskDataUrl:
                  nullable: false
                  title: String
                  type: string
                  description: 'Image data of the mask layer used for inpainting. In base64 format. Prefix: `data:image/jpeg;base64,`. Mask should be white on black where generation is applied to the white area.'
                prompt:
                  nullable: false
                  title: String
                  type: string
                  description: The prompt used to generate images
                guidance:
                  nullable: true
                  title: Float
                  type: number
                  description: How strongly the generation should reflect the prompt. Must be a float between 0.5 and 20.
                strength:
                  nullable: true
                  title: Float
                  type: number
                  description: Creativity strength of generation. Higher strength will deviate more from the original image supplied in imageDataUrl. Must be a float between 0.1 and 1.
                requestTimestamp:
                  $ref: '#/components/schemas/timestamp'
                style:
                  $ref: '#/components/schemas/lcm_generation_style'
                steps:
                  nullable: true
                  title: Int
                  type: integer
                  description: The number of steps to use for the generation. Must be between 4 and 16.
                width:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                height:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                seed:
                  $ref: '#/components/schemas/seed'
              type: object
              required:
              - imageDataUrl
              - maskDataUrl
              - prompt
        description: Query parameters can also be provided in the request body as a JSON object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  lcmGenerationJob:
                    nullable: true
                    properties:
                      imageDataUrl:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      requestTimestamp:
                        $ref: '#/components/schemas/timestamp'
                      apiCreditCost:
                        $ref: '#/components/schemas/apiCreditCost'
                      cost:
                        $ref: '#/components/schemas/cost'
                    title: LcmGenerationOutput
                    type: object
              example:
                lcmGenerationJob:
                  imageDataUrl:
                  - data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD...
                  requestTimestamp: '1234567892'
                  apiCreditCost: null
                  cost:
                    amount: '0.0147'
                    unit: DOLLARS
          description: Responses for POST /lcm-inpainting
  /lcm-upscale:
    post:
      tags:
      - Realtime Canvas
      summary: Perform Alchemy Upscale on a LCM image
      description: This endpoint will perform Alchemy Upscale on a LCM image
      operationId: performAlchemyUpscaleLCM
      requestBody:
        content:
          application/json:
            schema:
              properties:
                imageDataUrl:
                  nullable: false
                  title: String
                  type: string
                  description: 'Image data used to generate image. In base64 format. Prefix: `data:image/jpeg;base64,`'
                prompt:
                  nullable: false
                  title: String
                  type: string
                  description: The prompt used to generate images
                guidance:
                  nullable: true
                  title: Float
                  type: number
                  description: How strongly the generation should reflect the prompt. Must be a float between 0.5 and 20.
                strength:
                  nullable: true
                  title: Float
                  type: number
                  description: Creativity strength of generation. Higher strength will deviate more from the original image supplied in imageDataUrl. Must be a float between 0.1 and 1.
                requestTimestamp:
                  $ref: '#/components/schemas/timestamp'
                style:
                  $ref: '#/components/schemas/lcm_generation_style'
                steps:
                  nullable: true
                  title: Int
                  type: integer
                  description: The number of steps to use for the generation. Must be between 4 and 16.
                width:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                height:
                  nullable: true
                  title: Int
                  type: integer
                  description: The output width of the image. Must be 512, 640 or 1024.
                  default: 512
                seed:
                  $ref: '#/components/schemas/seed'
                refineCreative:
                  nullable: true
                  title: Boolean
                  type: boolean
                  description: Refine creative
                refineStrength:
                  nullable: true
                  title: Float
                  type: number
                  description: Must be a float between 0.5 and 0.9.
              type: object
              required:
              - imageDataUrl
              - prompt
        description: Query parameters can also be provided in the request body as a JSON object
        required: false
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  lcmGenerationJob:
                    nullable: true
                    properties:
                      imageDataUrl:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      generationId:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      variationId:
                        nullable: false
                        title: Array of Strings
                        type: array
                        items:
                          type: string
                      generatedImageId:
                        nullable: false
                        title: String
                        type: string
                      requestTimestamp:
                        $ref: '#/components/schemas/timestamp'
                      apiCreditCost:
                        $ref: '#/components/schemas/apiCreditCost'
                      cost:
                        $ref: '#/components/schemas/cost'
                    title: LcmGenerationOutput
                    type: object
              example:
                lcmGenerationJob:
                  imageDataUrl:
                  - data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAAAAAAAD...
                  variationId:
                  - var234567-8901-bcde-fghi-jklmnopqrstu
                  generatedImageId: l1m2n3o4-p5q6-r7s8-tuvw-xy0123456789
                  requestTimestamp: '1234567893'
                  apiCreditCost: null
                  cost:
                    amount: '0.0147'
                    unit: DOLLARS
          description: Responses for POST /lcm-upscale
components:
  schemas:
    timestamp:
      type: string
      nullable: false
      title: timestamp
    lcm_generation_style:
      type: string
      nullable: true
      title: lcm_generation_style
      enum:
      - ANIME
      - CINEMATIC
      - DIGITAL_ART
      - DYNAMIC
      - ENVIRONMENT
      - FANTASY_ART
      - ILLUSTRATION
      - PHOTOGRAPHY
      - RENDER_3D
      - RAYTRACED
      - SKETCH_BW
      - SKETCH_COLOR
      - VIBRANT
      - NONE
      description: The style to generate LCM images with.
    seed:
      type: integer
      nullable: true
      title: seed
      description: Apply a fixed seed to maintain consistency across generation sets. The maximum seed value is 2147483637 for Flux and 9999999998 for other models
    apiCreditCost:
      nullable: true
      title: Int
      type: integer
      description: 'API credits cost, available for Production API users. Note: it will be deprecated. Please use the cost instead.'
      deprecated: true
    cost:
      nullable: true
      type: object
      title: Cost
      description: The cost of the operation.
      properties:
        amount:
          type: string
          description: The amount of the cost.
        unit:
          type: string
          enum:
          - CREDITS
          - DOLLARS
          description: 'The unit of the cost. Can be CREDITS or DOLLARS. Note: DOLLARS unit only supports PAYG plan.'
  securitySchemes:
    bearerAuth:
      type: http
      bearerFormat: auth-scheme
      description: 'Bearer HTTP authentication. Allowed headers `Authorization: Bearer <api_key>`'
      scheme: bearer