Build with HiAPI
One API key reaches every text, image, video and audio model on HiAPI. They fall into two groups with completely different calling shapes, so start by picking the path that matches what you’re building.
| What you’re building | Which path | Calling shape |
|---|---|---|
| Chat, reasoning, coding, structured output, agents | Text reasoning | Synchronous — one call, one response (OpenAI-compatible) |
| Images, video, audio | Media generation | Asynchronous task — submit, then poll or wait for a callback |
Both paths share one API key and one base URL:
https://api.hiapi.ai
Before you start, create a key in the Dashboard → API Keys and top up — new accounts usually get enough trial balance to run the whole flow end to end.
Tip — Hand the docs index to your AI assistant and let it pick the integration for you:
https://hiapi.ai/llms.txt.
Text reasoning
A synchronous API that speaks the OpenAI protocol, so most existing SDKs and clients only need a new base URL and key.
| Protocol | Endpoint | Good for |
|---|---|---|
| Responses API | POST /v1/responses | The recommended default: response events, reasoning controls, structured output, built-in tools |
| Chat Completions API | POST /v1/chat/completions | The widest compatibility — nearly every third-party SDK and client supports it |
cURL
curl https://api.hiapi.ai/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "Explain sparse attention."}]
}'
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.hiapi.ai/v1", api_key="YOUR_API_KEY")
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[{"role": "user", "content": "Explain sparse attention."}],
)
print(resp.choices[0].message.content)
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.hiapi.ai/v1", apiKey: "YOUR_API_KEY" });
const resp = await client.chat.completions.create({
model: "deepseek-v4-flash",
messages: [{ role: "user", content: "Explain sparse attention." }],
});
console.log(resp.choices[0].message.content);
For the full field set — streaming, reasoning effort, JSON mode, tool calls — see Chat Completions API and Responses API.
Media generation
Images, video and audio are all asynchronous tasks: POST /v1/tasks returns a taskId immediately while the model keeps working in the background, and you collect the result by polling or callback.
Every media model shares this one endpoint; only the fields inside input differ — what a given model accepts is documented on its model page.
cURL (submit a task)
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana",
"input": { "prompt": "a cyan glass data center entrance" }
}'
# => { "code": 200, "data": { "taskId": "tk-hiapi-..." } }
Python
import requests
resp = requests.post(
"https://api.hiapi.ai/v1/tasks",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"model": "nano-banana",
"input": {"prompt": "a cyan glass data center entrance"},
},
)
print(resp.json()["data"]["taskId"])
Node.js
const resp = await fetch("https://api.hiapi.ai/v1/tasks", {
method: "POST",
headers: {
Authorization: "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "nano-banana",
input: { prompt: "a cyan glass data center entrance" },
}),
});
const { data } = await resp.json();
console.log(data.taskId);
Get the result
Poll GET /v1/tasks/:id until status becomes success, then download from data.output[0].url:
curl https://api.hiapi.ai/v1/tasks/tk-hiapi-... \
-H "Authorization: Bearer YOUR_API_KEY"
# status: queued / handling / archiving / success / fail
In production a callback beats polling — callbacks push the final state to your endpoint so you don’t have to poll.
Outputs are temporary and expire after about 7 days. To keep them, pass "storage": "persistent" when submitting, or promote them later.
Next steps
- Authentication — key scopes, request signing, and how to protect a production key.
- Rate limits — the two buckets, and how to back off on
429. - Media generation SDK — official Python, Go, Java and Node.js clients that wrap submit, poll and idempotent retries.
- Agent tools — use HiAPI directly inside Claude Code, Codex, Cherry Studio and more.
- Model catalog — every model, its parameters and pricing.