openapi: 3.0.3
servers:
  - url: https://prod.api.market/api/v1/magicapi/stable
info:
  title: "Stable Diffusion: Advanced Text-to-Image API"
  description: Generate high-quality, AI-driven images from text prompts with
    dynamic sizing and speed-optimized models for creative and research
    applications.
  version: 1.0.4
paths:
  /image/run:
    post:
      summary: Generate an image using Stable Diffusion
      operationId: runStableDiffusionImageGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                input:
                  type: object
                  properties:
                    width:
                      type: integer
                      description: Width of the generated image.
                      example: 768
                    height:
                      type: integer
                      description: Height of the generated image.
                      example: 768
                    prompt:
                      type: string
                      description: Text prompt to guide image generation.
                      example: an astronaut riding a horse on mars, hd, dramatic lighting
                    scheduler:
                      type: string
                      description: The scheduler to use for image generation.
                      example: K_EULER
                    num_outputs:
                      type: integer
                      description: Number of images to generate.
                      example: 1
                    guidance_scale:
                      type: number
                      description: Guidance scale to influence how closely the image matches the
                        prompt.
                      example: 7.5
                    num_inference_steps:
                      type: integer
                      description: Number of inference steps for the image generation process.
                      example: 50
                  required:
                    - input
      responses:
        "200":
          description: Image generated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: The current status of the image generation task.
                    example: IN_QUEUE
                  id:
                    type: string
                    description: The unique ID of the image generation request.
                    example: 4f4b5af4-d5d0-413b-ba76-cee0f6d630b2-u1
        "400":
          description: Invalid input
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 400
                  message:
                    type: string
                    example: Invalid request
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: Unauthorized
      security:
        - apiKeyAuth: []
    parameters:
      - &a1
        description: API.market API Key
        in: header
        name: x-api-market-key
        value: Please Login/Signup to get an API Key
        required: true
        schema:
          type: string
  /image/status/{taskId}:
    get:
      summary: Check the status of an image generation task
      operationId: getStableDiffusionImageStatus
      parameters:
        - name: taskId
          in: path
          required: true
          schema:
            type: string
          description: The unique ID of the image generation task.
          example: 2738f1de-3a1f-4511-8501-c0ab7b24b05c-e1
      responses:
        "200":
          description: Status of the image generation task
          content:
            application/json:
              schema:
                type: object
                properties:
                  delayTime:
                    type: integer
                    description: Delay time for task
                    example: 410
                  executionTime:
                    type: integer
                    description: Execution time of task in milliseconds
                    example: 5329
                  id:
                    type: string
                    description: The unique ID of the image generation task.
                    example: a72ff596-9276-4a3b-825f-2d30898a7807-u1
                  output:
                    type: array
                    description: Array of output data
                    items:
                      type: string
                      example: data:None;base64,UklGRk59AABXRU..........zquYqRUYwyAAAAAA==
                  status:
                    type: string
                    description: The current status of the image generation task.
                    example: COMPLETED
                  workerId:
                    type: string
                    description: The ID of the worker processing the task.
                    example: 63a0wc0ornlzkv
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 401
                  message:
                    type: string
                    example: Unauthorized
        "404":
          description: Task ID not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                    example: 404
                  message:
                    type: string
                    example: Task ID not found
      security:
        - apiKeyAuth: []
    parameters:
      - *a1
components:
  securitySchemes: {}
security: {}
tags:
  - name: artificial-intelligence
    description: Operations related to artificial-intelligence
  - name: tools
    description: Operations related to tools
  - name: visual-recognition
    description: Operations related to visual-recognition
  - name: text-to-image
    description: Operations related to text-to-image
