Connect and integrate
HiAPI has two families of API surface. Pick the one your workload needs — most products end up using both.
Text reasoning
For chat, reasoning, structured output, and tool calls, point an OpenAI-compatible client at HiAPI and keep your existing code.
| Option | When to use |
|---|---|
Responses — POST /v1/responses | Recommended for new text integrations: reasoning controls, structured output, built-in tools. |
Chat Completions — POST /v1/chat/completions | Existing OpenAI SDK code — change base_url and keep everything else. |
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)
- Guide: Text reasoning
- Reference: OpenAI · Chat Completions · OpenAI · Responses
Media generation
Image, video, and audio models all run on one asynchronous task API: submit, then poll or wait for a callback, then read the output URL.
curl -X POST https://api.hiapi.ai/v1/tasks \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "happyhorse-1.0", "input": {"prompt": "a cyan glass data center entrance", "duration": 5, "resolution": "720p"}}'
- Guide: Media generation
- Reference: POST /v1/tasks · GET /v1/tasks · GET /v1/tasks/{id}
Let an agent write the call
If you are integrating through an AI coding tool rather than writing HTTP by hand:
- Agent Skills — install a skill into Claude Code, Codex, or OpenClaw; the agent applies the documented model parameters. Skills
- Remote MCP — connect an MCP client to
https://mcp.hiapi.ai/mcpwith your API key; the agent calls the tools directly. MCP - Official SDKs — zero-dependency clients for Python, Go, Java, and Node.js. SDK
Before production
- Authentication — API keys, scopes, and keeping them out of client code.
- Rate limits — the two buckets and how to back off on
429.