HiAPI
ModelsPricingPromoBlogDocs
API Reference

API Documentation

One unified async task API for image and video generation. Submit a task, get a taskId, then poll or receive a callback.

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

1

Get your API key

Sign up and create an API key from the dashboard. New users get $1 free credit to start.

2

Prepare an HTTP client

No dedicated SDK required — any language that can make HTTPS requests works.

# No installation needed for cURL
3

Make 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_KEY

Never 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/v1

API Endpoints

Create Task

POST/v1/tasks

Submit 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

NameTypeRequiredDescription
modelstringRequiredTarget model name, e.g. gpt-image-2
inputobjectRequiredModel business parameters; fields vary by model (e.g. prompt, resolution)
callbackobjectOptionalOptional 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

GET/v1/tasks/:id

Query 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

NameTypeRequiredDescription
idstringRequiredThe 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 CodeDescription
400Bad Request — Invalid parameters or missing required fields
401Unauthorized — Invalid or missing API key
402Payment Required — Balance can't cover the estimated task cost. Top up and retry.
403Forbidden — Insufficient permissions or account suspended
429Too Many Requests — Rate limit exceeded. Please slow down.
500Internal 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"
}

Ready to build?

Get your API key and start generating images, videos, and more in minutes.

HiAPI

One API, All AI Models

Company

  • About

Legal

  • Terms of Service
  • Privacy Policy
© 2026 hiapi. All rights reserved.