Text-to-Image API
Create an asynchronous image generation task from a text prompt. This same endpoint supports nano, nano2, and nano2pro through the model field.
Authentication
Send your API key as a Bearer token. You can create keys from Dashboard > API Keys.
Authorization: Bearer YOUR_API_KEYModel Selection
Use this same /api/generate endpoint for every text-to-image model. model is optional only for backward compatibility; new integrations should set it explicitly.
nanoOriginal Nano AI Fast backend. Default when model is omitted.
nano2Nano AI 2 backend for new integrations.
nano2proNano AI 2 Pro backend for higher quality output.
Endpoint
The endpoint returns a task_id immediately. Poll /api/status to retrieve the final result.
Text prompt describing the image to generate.
Supported values: nano, nano2, nano2pro. Defaults to nano.
Output aspect ratio for Nano AI 2 models, such as 1:1, 16:9, or 9:16. Defaults to 1:1.
Resolution. The API accepts either field and normalizes it for the selected backend. Supported values: 1K, 2K, 4K.
Output image format. Defaults to png.
Example request
{
"prompt": "A professional product photo of a modern wristwatch on a clean white background",
"model": "nano2",
"aspect_ratio": "1:1",
"size": "1K",
"format": "png"
}Example response
The task has been accepted for asynchronous processing.
{
"code": 200,
"message": "success",
"task_id": "nprob71e549f645122eb8db5f75af2c11nono",
"model": "nano2",
"data": {
"task_id": "nprob71e549f645122eb8db5f75af2c11nono"
}
}Next Step
Save the returned task_id and poll the status endpoint until the task reaches a final state.
Common Errors
{
"code": 400,
"message": "Bad Request: 'prompt' is required.",
"data": null
}