Unified Task API
Image and video models share a single /v1/tasks endpoint. Every submission returns a taskId — fetch results by polling or callback.
Secure by Default
All requests are encrypted via HTTPS. API keys are scoped and can be revoked at any time.
Global CDN
Low-latency access from anywhere. Our infrastructure is distributed across multiple regions.
Quick Start
Prepare an HTTP client
No dedicated SDK required — any language that can make HTTPS requests works.
# No installation needed for cURLMake your first API call
Submit an image generation task and get a taskId back instantly. Replace YOUR_API_KEY with your actual key.
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-2", "input": {"prompt": "a cute cat"}}'Authentication
All API requests require an API key passed in the Authorization header as a Bearer token.
Authorization: Bearer YOUR_API_KEYNever expose your API key in client-side code or public repositories. Use environment variables to store your key securely.
Base URL
All API endpoints are relative to this base URL.
https://api.hiapi.ai/v1API Endpoints
Create Task
/v1/tasksSubmit an async generation task. Returns a taskId immediately without waiting for generation to finish. Fields inside input vary by model — see each model page's API examples.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Target model name, e.g. gpt-image-2 |
| input | object | Required | Model business parameters; fields vary by model (e.g. prompt, resolution) |
| callback | object | Optional | Optional terminal-notification config. Omit it and poll for results yourself |
Code Example
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"input": {
"prompt": "a cute cat sitting on a windowsill"
}
}'Get Task Detail
/v1/tasks/:idQuery status and results with the taskId returned at creation. status is queued / handling / archiving / success / fail; on success an output array is returned and each url is directly downloadable.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| id | string | Required | The taskId returned at creation, prefixed tk-hiapi- |
Code Example
curl https://api.hiapi.ai/v1/tasks/tk-hiapi-01HZTQ8BX2N3GM3YFK4Z9D7VQR \
-H "Authorization: Bearer YOUR_API_KEY"Error Handling
The API uses standard HTTP status codes. Errors return a JSON object with details.
| Status Code | Description |
|---|---|
| 400 | Bad Request — Invalid parameters or missing required fields |
| 401 | Unauthorized — Invalid or missing API key |
| 402 | Payment Required — Balance can't cover the estimated task cost. Top up and retry. |
| 403 | Forbidden — Insufficient permissions or account suspended |
| 429 | Too Many Requests — Rate limit exceeded. Please slow down. |
| 500 | Internal Server Error — Something went wrong on our end. Try again later. |
Error Response Format
{
"code": 400,
"message": "invalid request",
"data": null,
"error_code": "INVALID_REQUEST"
}