Submit a generation task to any supported AI model.
Endpoint
POST https://api.apixo.ai/api/v1/generateTask/{model}
Replace {model} with the model ID (e.g., nano-banana, flux-2, sora-2, midjourney).
Bearer token for API authentication. Format: Bearer YOUR_API_KEY
Must be application/json.
Request Body
request_type
string
default: "async"
required
How to receive results. async for polling via the status endpoint, callback for webhook delivery.
Webhook URL for receiving results. Required when request_type is callback. Must be a publicly accessible HTTPS URL that responds with HTTP 200 within 30 seconds. See Webhooks for details.
Model-specific generation parameters. Generation mode (e.g., text-to-image, image-to-image, text-to-video).
Text description of the desired output.
Reference images for editing modes (e.g., image-to-image).
Output dimensions ratio (e.g., 1:1, 16:9, 9:16).
Response
{
"code" : 200 ,
"message" : "success" ,
"data" : {
"taskId" : "task_abc123xyz789"
}
}
Human-readable status message.
Unique identifier for tracking the task. Use this to query status .
Save the taskId — you’ll need it to query status or debug issues later.
Examples
Async Mode (Polling)
curl -X POST https://api.apixo.ai/api/v1/generateTask/nano-banana \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "async",
"input": {
"mode": "text-to-image",
"prompt": "A futuristic city at sunset",
"aspect_ratio": "16:9"
}
}'
const response = await fetch ( 'https://api.apixo.ai/api/v1/generateTask/nano-banana' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_API_KEY' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({
request_type: 'async' ,
input: {
mode: 'text-to-image' ,
prompt: 'A futuristic city at sunset' ,
aspect_ratio: '16:9' ,
},
}),
});
const { data } = await response . json ();
console . log ( 'Task ID:' , data . taskId );
import requests
response = requests.post(
'https://api.apixo.ai/api/v1/generateTask/nano-banana' ,
headers = {
'Authorization' : 'Bearer YOUR_API_KEY' ,
'Content-Type' : 'application/json' ,
},
json = {
'request_type' : 'async' ,
'input' : {
'mode' : 'text-to-image' ,
'prompt' : 'A futuristic city at sunset' ,
'aspect_ratio' : '16:9' ,
},
}
)
task_id = response.json()[ 'data' ][ 'taskId' ]
print ( f 'Task ID: { task_id } ' )
Callback Mode (Webhooks)
curl -X POST https://api.apixo.ai/api/v1/generateTask/nano-banana \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request_type": "callback",
"callback_url": "https://your-server.com/webhook/apixo",
"input": {
"mode": "text-to-image",
"prompt": "A futuristic city at sunset",
"aspect_ratio": "16:9"
}
}'
const response = await fetch ( 'https://api.apixo.ai/api/v1/generateTask/nano-banana' , {
method: 'POST' ,
headers: {
'Authorization' : 'Bearer YOUR_API_KEY' ,
'Content-Type' : 'application/json' ,
},
body: JSON . stringify ({
request_type: 'callback' ,
callback_url: 'https://your-server.com/webhook/apixo' ,
input: {
mode: 'text-to-image' ,
prompt: 'A futuristic city at sunset' ,
aspect_ratio: '16:9' ,
},
}),
});
response = requests.post(
'https://api.apixo.ai/api/v1/generateTask/nano-banana' ,
headers = {
'Authorization' : 'Bearer YOUR_API_KEY' ,
'Content-Type' : 'application/json' ,
},
json = {
'request_type' : 'callback' ,
'callback_url' : 'https://your-server.com/webhook/apixo' ,
'input' : {
'mode' : 'text-to-image' ,
'prompt' : 'A futuristic city at sunset' ,
'aspect_ratio' : '16:9' ,
},
}
)
Error Responses
Code Description 400Invalid request parameters 401Invalid or missing API key 403Insufficient permissions 429Rate limit exceeded 500Server error
See Errors for detailed error handling.