Skip to main content
POST
/
v2
/
image
/
agent
cURL
curl --request POST \
  --url https://api.tokenkit.co/v2/image/agent \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form 'instructions=<string>' \
  --form model_id=image-agent-1-preview \
  --form 'agent_id=<string>' \
  --form aspect_ratio=1:1 \
  --form resolution=2K \
  --form 'webhook_url=<string>' \
  --form max_steps=10 \
  --form images.0='@example-file' \
  --form images.2.items.0='@example-file'
{
  "data": {
    "job_id": "job_123",
    "links": {
      "self": "/v1/jobs/job_123",
      "stream": "/v1/jobs/job_123/stream"
    }
  },
  "errors": null
}

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

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

multipart/form-data
instructions
string
required
Required string length: 3 - 10000
model_id
enum<string>
default:image-agent-1-preview
Available options:
image-agent-1-preview
agent_id
string
aspect_ratio
enum<string>
default:1:1
Available options:
auto,
9:16,
2:3,
3:4,
4:5,
1:1,
5:4,
4:3,
3:2,
16:9
resolution
enum<string>
default:2K
Available options:
2K,
4K
images
default:[]
webhook_url
string<uri>

Must be a valid URL

max_steps
integer
default:10
Required range: 1 <= x <= 30

Response

Job accepted

data
object
required
errors
unknown