# HiAPI > HiAPI provides Responses and Chat Completions for text models and an asynchronous task API for image, video, and audio generation. API base URL: https://api.hiapi.ai Documentation: https://www.hiapi.ai/docs/ ## Choose an integration - Text API: use Responses or compatible Chat Completions according to the model page. - Media API: use the asynchronous task workflow for image, video, and audio models. - Remote MCP: connect to https://mcp.hiapi.ai/mcp with the API key as a Bearer token. It exposes 9 live-catalog tools: `generate_image`, `edit_image`, `generate_video`, `generate_audio`, `generate_text`, `get_task_status`, `list_models`, `get_model_capabilities`, and `get_pricing`. Media generation uses `/v1/tasks`; text generation uses the model's Chat Completions or Responses route. - Agent Skills: browse https://github.com/HiAPIAI/hiapi-skills. ## Authentication ```http Authorization: Bearer YOUR_API_KEY Content-Type: application/json ``` Create or rotate keys at https://www.hiapi.ai/en/dashboard/api-keys. ## Create a response `POST https://api.hiapi.ai/v1/responses` Use this endpoint only for models whose page lists Responses support. Required fields are `model` and `input`; reasoning, storage, tools, and streaming semantics remain model-specific. ```json { "model": "deepseek-v4-pro", "input": "Explain the most important tradeoff.", "reasoning": { "effort": "high" }, "stream": false } ``` ## Create a chat completion `POST https://api.hiapi.ai/v1/chat/completions` Required fields are `model` and `messages`. Set `stream: true` for Server-Sent Events. Read the answer from `choices[0].message.content` and token billing details from `usage`. ```json { "model": "deepseek-v4-flash", "messages": [ { "role": "user", "content": "Explain sparse attention in three sentences." } ], "stream": false } ``` ## Create a generation task `POST https://api.hiapi.ai/v1/tasks` - `model` (string, required): HiAPI model ID. - `route` (string, optional): model route, such as beta, pro, or ext. - `input` (object, required): Model-specific parameters. See the selected model page for its input schema. - `callback` (object, optional): Terminal delivery settings. HTTP or HTTPS endpoint that receives the terminal task payload. - `storage` (string, optional): Requested output storage tier. Use an `Idempotency-Key` header when a submission may be retried. Reusing the same key with the same request returns the original `taskId`. ```json { "model": "gpt-image-2/text-to-image", "input": { "prompt": "A premium product photo on a clean studio background", "aspect_ratio": "1:1", "resolution": "1K" }, "callback": { "url": "https://example.com/hiapi/callback", "when": "final" } } ``` The response returns `data.taskId` immediately. ## Get the result Poll `GET https://api.hiapi.ai/v1/tasks/{taskId}`, or provide `callback.url` when creating the task. Interim status: `queued` → `handling` → `archiving`. Terminal status: `success` or `fail`. On `success`, read generated files from `data.output[].url`. Use exponential backoff when polling. ## Find a model and its input fields First fetch the machine-readable model index: `https://www.hiapi.ai/docs/models.json` Use each entry's `summary`, `capability`, and `bestFor` to select a model. Only call entries with `availability: "online"`. Text models expose `request`; media models expose `input` and optional `routes`. Then open the selected entry's `docs` or `docsZh` URL for full field descriptions, examples, limits, and pricing links. Do not guess model names or parameters. - API documentation model directory: https://www.hiapi.ai/docs/models/ - Image API collection: https://www.hiapi.ai/docs/collections/ai-image-apis/ - Video API collection: https://www.hiapi.ai/docs/collections/ai-video-apis/ - Audio API collection: https://www.hiapi.ai/docs/collections/ai-audio-apis/ - Text API collection: https://www.hiapi.ai/docs/collections/ai-text-apis/ ## Sources of truth - Unified Async API: https://www.hiapi.ai/docs/async-api/ - Responses API: https://www.hiapi.ai/docs/text-api/responses/ - Chat Completions API: https://www.hiapi.ai/docs/text-api/chat-completions/ - OpenAPI: https://www.hiapi.ai/docs/hiapi.json - Pricing: https://www.hiapi.ai/en/pricing - Changelog: https://www.hiapi.ai/docs/changelog/