GPT Image 2 API
Generate images and videos with Nano Banana, Sora 2, Veo 3.1, Kling, and more — through a single REST API.
GPT Image 2 API gives you one REST endpoint per media type and handles routing to the right upstream model. Every job is asynchronous: you POST a request, receive a taskId, and poll until the task completes.
Base URL
https://gptimage2api.orgUse http://localhost:3000 when running against your local dev server.
Quick map
- Quickstart — submit your first image job with
curlin under five minutes. - Authentication — current session auth + the upcoming Bearer token contract.
- API reference — interactive schema for every endpoint.
- Guides — polling, credits & models, errors & refunds.
How a request flows
Submit
POST /api/ai/image/generate or POST /api/ai/video/generate with a JSON body describing the prompt, model, and optional parameters.
Receive taskId
The response is { taskId, status: 0, creditsUsed }. Credits are pre-debited up front.
Poll
GET /api/ai/tasks/{taskId} returns the current snapshot. Keep polling while status === 0. Status 1 means completed, 2 means failed.
Download
On success the response contains imageUrls[] (image jobs) or videoUrl (video jobs). On failure credits are refunded automatically.