Content Generation API
Overview
Anyone can generate media with our APIs - no subscription required.
We use the x402 standard to charge per request via stablecoins (ie USDC on Base Chain).
Request Flow
Generation request is submitted to
/generation/createThe server estimates the cost based on the payload and responds with HTTP status code
402 PAYMENT REQUIREDThe sender completes the onchain payment and submits the request again with the payment headers
The server verifies the payment, submits the generation request, and returns HTTP status code
202 ACCEPTEDand response body withtaskIdThe sender can poll using
generation/statusandtaskIdwhere the generation result is returned
ℹ️ Learn how to handle the x402 payment flow here
🤖 Building an agent? Use our ElizaOS plugin
Guide
This guide demonstrates the typical workflow for generating AI content using the Imagine API.
Base URL
https://eliza.getimagine.clubStep 1: Create Generation Request
Submit your generation request with x402 payment handling.
POST /generation/create
Content-Type: multipart/form-dataForm Data:
prompt: "A futuristic character waves in a neon cyberpunk city"
templateData: '{"duration": 8}'
image: [binary file] (optional)Response (402 Payment Required):
{
"x402Version": 1,
"error": "X-PAYMENT header is required",
"accepts": [
{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "5000",
"resource": "http://eliza.getimagine.club/generation/create",
"description": "Generate video",
"mimeType": "",
"payTo": "0x21aF1185734D213D45C6236146fb81E2b0E8b821",
"maxTimeoutSeconds": 60,
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"extra": {
"name": "USD Coin",
"version": "2"
}
}
]
}(with X-PAYMENT header)
Content-Type: application/json
X-PAYMENT: <x402-payment-proof>Response
{
"taskId": "123e4567-e89b-12d3-a456-426614174000"
}Step 2: Poll for Task Status
Check the generation progress using the returned task ID.
GET /generation/123e4567-e89b-12d3-a456-426614174000/statusResponse (Processing):
{
"status": "processing"
}Response (Queued):
{
"status": "queued"
}Step 3: Get Final Result
When the task is complete, retrieve your generated content.
Response (200 Completed):
{
"status": "completed",
"result": {
"generation": {
"text": "Generated description text",
"image": "https://storj.onbons.ai/preview-image-url",
"video": {
"url": "https://storj.onbons.ai/generated-video-url"
},
"templateName": "video",
"agentId": "agent-uuid"
},
"templateData": {
"duration": 8
}
}
}Last updated