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

# Image Agent 1

> Run image-agent-1 with text instructions and optional reference images. Currently in early access preview.

## Request body

`multipart/form-data` (recommended when sending images)

* `model_id` (`validImageModelIds`, optional): Defaults to `"image-agent-1-preview"`
* `agent_id` (`string`, optional)
* `instructions` (`string`, required): Between `3` and `10,000` characters
* `aspect_ratio` (`"auto" | validAspectRatios`, optional): Defaults to `"1:1"`
* `resolution` (`validResolutions`, optional): Defaults to `"2K"`
* `images` (`file | file[]`, optional): Single image or up to `10` images, each max `30MB`; defaults to `[]`
* `webhook_url` (`string`, optional): Must be a valid URL
* `max_steps` (`number`, optional): Minimum `1`, maximum `30`, defaults to `10`

## Validation rules

* `instructions` minimum length: `3`
* `instructions` maximum length: `10,000`
* `images` accepts either:
  * a single image
  * an array of images (max `10`)
* `images` is normalized to an array internally


## OpenAPI

````yaml POST /v2/image/agent
openapi: 3.1.0
info:
  title: TokenKit
  description: >-
    Building image agents and tools, with APIs for businesses that want to put
    them to work.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tokenkit.co
security:
  - bearerAuth: []
paths:
  /v2/image/agent:
    post:
      description: Run the image agent workflow.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ImageAgentRequest'
      responses:
        '202':
          description: Job accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobAccepted'
        '400':
          description: Validation error
        '429':
          description: Queue saturated
components:
  schemas:
    ImageAgentRequest:
      type: object
      properties:
        model_id:
          $ref: '#/components/schemas/ImageModelId'
        agent_id:
          type: string
        instructions:
          type: string
          minLength: 3
          maxLength: 10000
        aspect_ratio:
          $ref: '#/components/schemas/ImageAspectRatioOrAuto'
        resolution:
          $ref: '#/components/schemas/ImageResolution'
        images:
          oneOf:
            - $ref: '#/components/schemas/FileOrUrl'
            - type: array
              items:
                $ref: '#/components/schemas/FileOrUrl'
              maxItems: 10
          default: []
        webhook_url:
          type: string
          format: uri
          description: Must be a valid URL
        max_steps:
          type: integer
          minimum: 1
          maximum: 30
          default: 10
      required:
        - instructions
    JobAccepted:
      type: object
      properties:
        data:
          type: object
          properties:
            job_id:
              type: string
              example: job_123
            links:
              $ref: '#/components/schemas/JobLinks'
          required:
            - job_id
            - links
        errors:
          nullable: true
      required:
        - data
    ImageModelId:
      type: string
      enum:
        - image-agent-1-preview
      default: image-agent-1-preview
    ImageAspectRatioOrAuto:
      type: string
      enum:
        - auto
        - '9:16'
        - '2:3'
        - '3:4'
        - '4:5'
        - '1:1'
        - '5:4'
        - '4:3'
        - '3:2'
        - '16:9'
      default: '1:1'
    ImageResolution:
      type: string
      enum:
        - 2K
        - 4K
      default: 2K
    FileOrUrl:
      oneOf:
        - type: string
          format: binary
        - type: string
          format: uri
    JobLinks:
      type: object
      properties:
        self:
          type: string
          example: /v1/jobs/job_123
        stream:
          type: string
          example: /v1/jobs/job_123/stream
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````