GPT API for Developers: Media Generation and Task Queries
Explore the available image, video and music task APIs, user API keys, account credits and integration requirements before making your first request.
Last updated: 2026-11-12
Start with a media task
Add image, video or music generation to your service: select a current model, confirm its parameters and credit quote, create a task, then query its status and results. You can also explore prompts and settings in the workspace first.
Read the quickstart
·
Understand credits and billing
Available capabilities
- Create a media task:
POST /api/ai/generate. SupportedmediaTypevalues areimage,videoandmusic. - Query a task:
GET /api/ai/task?taskId=TASK_IDreturns a task belonging to your account. For batches, use comma-separatedtaskIds, with at most 10 per request. - Read the model catalog:
GET /api/ai/router01/models?type=image. Image, video and music use catalog typesimage,videoandaudio, respectively. Music creation still usesmediaType: "music". - Request a credit quote:
POST /api/ai/router01/quoteestimates a request using its model, prompt, references and options. A quote does not create a generation task. The server recalculates pricing when you submit.
The catalog and quote endpoints currently require no user API key for server-side requests. Their browser cross-origin support differs from generation and task queries; integrating through your backend is recommended. The catalog depends on the current service configuration. Use a model’s slug as its request ID, not its display name.
Using an API key
Sign in and create a user key in API key management. Send it in the following header:
Authorization: Bearer sk_replace_with_your_key
User keys start with sk_ and can authenticate media generation and task queries. Keys identify their owning account; multiple keys share that account’s credits. Creating a key does not create a separate balance. Key management requires website sign-in; a user key cannot create additional keys.
Client authorization can issue a ct_ token, which also works with these media endpoints but is a different credential. Administrator credentials are not product API credentials. Account and credit-query endpoints accept website sessions or client tokens, not user sk_ keys. With a user key integration, check balances and credit records on your account pages.
Keep keys in server environment variables or secure credential storage. For an application used by other people, call the service from your backend rather than distributing your account key to browsers.
Request lifecycle
- Select a model for the intended media type and inspect its
paramsfor required fields, options, defaults and limits. - Quote the same model, prompt, references and
optionsyou intend to submit, then review the credit cost. - Submit once, check both the HTTP status and business
code, and savedata.idfrom the successful response. - Query the saved ID.
queued,pendingandprocessingare non-terminal;success,failedandcanceledare terminal. - Read the media result after success. For failure or cancellation, inspect
taskInfo.userErrorCodeand check the account’s credit records.
A successful submission acknowledges a task; it does not mean media generation succeeded. Model versions, options and costs can change with the catalog, so confirm them before generating.
Protocol and tool compatibility
This integration uses the site’s media-task protocol and JSON responses. Standard /v1/chat/completions and /v1/responses calls are outside the interface documented here. The workspace Agent conversation interface is not a general text API authenticated with user keys.
For tools such as n8n, use a workflow that can send custom HTTP requests, parse JSON and query asynchronous tasks. Changing a Base URL alone does not establish compatibility with an existing OpenAI node. Confirm native nodes, streaming conversations or other protocols with support before relying on them.
API paths do not have language prefixes. Examples on translated pages still call /api/….
Credits, retries and ownership
Media tasks use the account’s existing credits. Keys do not require separate top-ups or establish separate model rates. Review current prices, allowances and validity on the plans page, and the charging flow in API billing.
Each submission can create a new task and charge credits; this interface does not document an idempotency key. Once you have a task ID, query that task instead of resubmitting after timeouts, connection interruptions or long queues. Tasks are accessible only to their owning account; a different account’s key cannot retrieve them.
Continue
-
Quickstart: create and query your first task
-
Billing: quotes, credit charges and failures
-
Troubleshooting: authentication, credits, parameters and tasks
-
Privacy Policy
·Terms of Service
For model availability, integrations or account questions, contact support@gptapi.app. Include your media type, tools and expected usage, never your full key.