openapi: 3.0.0
servers:
  - url: https://prod.api.market/api/v1/magicapi/photorealistic-text-to-image-api
info:
  title: Photorealistic Text-to-Image Generator API (Imagen-4)
  description: Generate high-fidelity, lifelike images from text prompts instantly
    using Google's advanced Imagen-4 AI modelperfect for creating eye-catching
    visual content.
  version: 573cdf74dfdf9b1a42fc327a3887f96caa6f1bf90d086511b486792152abb9d9
components:
  schemas:
    Input:
      type: object
      title: Input
      required:
        - prompt
      properties:
        prompt:
          type: string
          title: Prompt
          x-order: 0
          description: Text prompt for image generation
          example: 'The photo: Create a cinematic, photorealistic medium shot capturing
            the nostalgic warmth of a late 90s indie film. The focus is a young
            woman with brightly dyed pink-gold hair and freckled skin, looking
            directly and intently into the camera lens with a hopeful yet
            slightly uncertain smile, she is slightly off-center. She wears an
            oversized, vintage band t-shirt that says "API.market" (slightly
            worn) over a long-sleeved striped top and simple silver stud
            earrings. The lighting is soft, golden hour sunlight streaming
            through a slightly dusty window, creating lens flare and
            illuminating dust motes in the air. The background shows a blurred,
            cluttered bedroom with posters on the wall and fairy lights,
            rendered with a shallow depth of field. Natural film grain, a warm,
            slightly muted color palette, and sharp focus on her expressive eyes
            enhance the intimate, authentic feel'
        aspect_ratio:
          allOf:
            - $ref: "#/components/schemas/aspect_ratio"
          default: 1:1
          x-order: 1
          description: Aspect ratio of the generated image
          example: 16:9
        safety_filter_level:
          allOf:
            - $ref: "#/components/schemas/safety_filter_level"
          default: block_only_high
          x-order: 2
          description: block_low_and_above is strictest, block_medium_and_above blocks
            some prompts, block_only_high is most permissive but some prompts
            will still be blocked
          example: block_medium_and_above
    Output:
      type: string
      title: Output
      format: uri
    Status:
      enum:
        - starting
        - processing
        - succeeded
        - canceled
        - failed
      type: string
      title: Status
      description: An enumeration.
    WebhookEvent:
      enum:
        - start
        - output
        - logs
        - completed
      type: string
      title: WebhookEvent
      description: An enumeration.
    aspect_ratio:
      enum:
        - 1:1
        - 9:16
        - 16:9
        - 3:4
        - 4:3
      type: string
      title: aspect_ratio
      description: An enumeration.
    ValidationError:
      type: object
      title: ValidationError
      required:
        - loc
        - msg
        - type
      properties:
        loc:
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
    PredictionRequest:
      type: object
      title: PredictionRequest
      properties:
        id:
          type: string
          title: Id
        input:
          $ref: "#/components/schemas/Input"
        context:
          type: object
          title: Context
          additionalProperties:
            type: string
        webhook:
          type: string
          title: Webhook
          format: uri
          maxLength: 65536
          minLength: 1
        created_at:
          type: string
          title: Created At
          format: date-time
        output_file_prefix:
          type: string
          title: Output File Prefix
        webhook_events_filter:
          type: array
          items:
            $ref: "#/components/schemas/WebhookEvent"
          default:
            - start
            - output
            - logs
            - completed
    PredictionResponse:
      type: object
      title: PredictionResponse
      properties:
        id:
          type: string
          title: Id
        logs:
          type: string
          title: Logs
          default: ""
        error:
          type: string
          title: Error
        input:
          $ref: "#/components/schemas/Input"
        output:
          $ref: "#/components/schemas/Output"
        status:
          $ref: "#/components/schemas/Status"
        metrics:
          type: object
          title: Metrics
        version:
          type: string
          title: Version
        created_at:
          type: string
          title: Created At
          format: date-time
        started_at:
          type: string
          title: Started At
          format: date-time
        completed_at:
          type: string
          title: Completed At
          format: date-time
    HTTPValidationError:
      type: object
      title: HTTPValidationError
      properties:
        detail:
          type: array
          items:
            $ref: "#/components/schemas/ValidationError"
          title: Detail
    safety_filter_level:
      enum:
        - block_low_and_above
        - block_medium_and_above
        - block_only_high
      type: string
      title: safety_filter_level
      description: An enumeration.
  securitySchemes: {}
security: {}
paths:
  /predictions:
    post:
      summary: Create a prediction with google/imagen-4
      description: Run inference with the google/imagen-4 model on API.market
      operationId: createImagen_4Prediction
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - version
                - input
              properties:
                version:
                  type: string
                  description: Model version ID
                  default: 573cdf74dfdf9b1a42fc327a3887f96caa6f1bf90d086511b486792152abb9d9
                input:
                  $ref: "#/components/schemas/Input"
            examples:
              default:
                summary: Default example
                value:
                  version: 573cdf74dfdf9b1a42fc327a3887f96caa6f1bf90d086511b486792152abb9d9
                  input:
                    prompt: 'The photo: Create a cinematic, photorealistic medium shot capturing the
                      nostalgic warmth of a late 90s indie film. The focus is a
                      young woman with brightly dyed pink-gold hair and freckled
                      skin, looking directly and intently into the camera lens
                      with a hopeful yet slightly uncertain smile, she is
                      slightly off-center. She wears an oversized, vintage band
                      t-shirt that says "API.market" (slightly worn) over a
                      long-sleeved striped top and simple silver stud earrings.
                      The lighting is soft, golden hour sunlight streaming
                      through a slightly dusty window, creating lens flare and
                      illuminating dust motes in the air. The background shows a
                      blurred, cluttered bedroom with posters on the wall and
                      fairy lights, rendered with a shallow depth of field.
                      Natural film grain, a warm, slightly muted color palette,
                      and sharp focus on her expressive eyes enhance the
                      intimate, authentic feel'
                    aspect_ratio: 16:9
                    safety_filter_level: block_medium_and_above
      responses:
        "201":
          description: Prediction created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique identifier for the prediction
                  version:
                    type: string
                    description: Model version used for the prediction
                  status:
                    type: string
                    enum:
                      - starting
                      - processing
                      - succeeded
                      - failed
                      - canceled
                    description: Current status of the prediction
                  created_at:
                    type: string
                    format: date-time
                    description: When the prediction was created
              examples:
                success:
                  summary: Successful prediction creation
                  value:
                    id: ufawqhfynnddngldkgtslldrkq
                    version: 573cdf74dfdf9b1a42fc327a3887f96caa6f1bf90d086511b486792152abb9d9
                    status: starting
                    created_at: 2025-06-05T19:43:18.144Z
        "400":
          description: Bad request, validation error
        "401":
          description: Unauthorized, invalid API token
    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
  /predictions/{id}:
    get:
      summary: Get prediction status and results
      description: Get the status and results of a google/imagen-4 prediction from
        API.market
      operationId: getImagen_4Prediction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The prediction ID
      responses:
        "200":
          description: Prediction details
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: Unique identifier for the prediction
                  status:
                    type: string
                    enum:
                      - starting
                      - processing
                      - succeeded
                      - failed
                      - canceled
                    description: Current status of the prediction
                  output:
                    $ref: "#/components/schemas/Output"
                  error:
                    type: string
                    description: Error message if the prediction failed
                  created_at:
                    type: string
                    format: date-time
                    description: When the prediction was created
                  started_at:
                    type: string
                    format: date-time
                    description: When the prediction started processing
                  completed_at:
                    type: string
                    format: date-time
                    description: When the prediction completed
              examples:
                succeeded:
                  summary: Successful prediction result
                  value:
                    id: ufawqhfynnddngldkgtslldrkq
                    status: succeeded
                    output: https://blog.api.market/wp-content/uploads/2025/06/api_market_imagen_4.jpg
                    created_at: 2023-01-01T12:00:00.000Z
                    started_at: 2023-01-01T12:00:05.000Z
                    completed_at: 2023-01-01T12:01:00.000Z
        "401":
          description: Unauthorized, invalid API token
        "404":
          description: Prediction not found
    parameters:
      - *a1
tags:
  - name: text-to-image
    description: Operations related to text-to-image
  - name: image-to-image
    description: Operations related to image-to-image
  - name: style-transfer
    description: Operations related to style-transfer
