HiAPI
  • Models
  • Pricing
Search

Search HiAPI models, tools, and resources.

  • Models
  • Pricing
HiAPI

One API, All AI Models

Generate images, video, and audio with leading models through one production-ready API.

Get a free API key

AI Image API

  • All image models
  • GPT Image 2
  • Nano Banana 2
  • Seedream 5.0 Pro
  • Qwen Image 2.0 Pro
  • FLUX 1.1 Pro

AI Video API

  • All video models
  • Seedance 2.5
  • FLUX.3 Video
  • Seedance 2.0
  • Veo 3.1
  • Kling 3.0

AI Audio API

  • All audio models
  • MiniMax Music 2.6
  • MiniMax Music 1.5
  • ElevenLabs v3
  • Text to music
  • Text to speech

Product

  • Model marketplace
  • Playground
  • Pricing
  • Image API Cost Calculator
  • Free GPT Image 2 Generator
  • Free Nano Banana Image Generator
  • Outfit Preview
  • Product Photo Lab

Developers

  • Documentation
  • API Reference
  • Agent Skills
  • LLM integration index
  • Blog

Company

  • About
  • Contact support
  • Terms of Service
  • Privacy Policy

© 2026 hiapi. All rights reserved.

Open source on GitHubPython SDK on PyPI
  • What you're building, and what you need
  • The minimal working request (curl)
  • The same flow in Python
  • Three modes, one model ID
  • Production notes: callbacks, idempotency, and real errors
  • Related pages
  • FAQ
TutorialAug 2, 2026

How to use minimax-h3 via the hiapi API: curl, Python, and a working request

hiapiminimax-h3Video APITutorialText to Video

Latest models

Explore models

Contents
  • What you're building, and what you need
  • The minimal working request (curl)
  • The same flow in Python
  • Three modes, one model ID
  • Production notes: callbacks, idempotency, and real errors
  • Related pages
  • FAQ

Generate it with HiAPI

Choose a model, enter your prompt, and see the result.

HiAPI Blog

Related articles

HiAPI

Generate it with HiAPI

MiniMax H3 is hiapi's native-2K video model, and it does more than plain text-to-video: the same model ID also does first/last-frame control and multimodal reference-to-video, switched purely by which input fields you send. This guide covers the minimal working request, a complete Python script, and the production details — callbacks, mode constraints, and the exact errors you'll hit.

What you're building, and what you need

Goal: send a prompt to POST /v1/tasks, poll until the task finishes, and download a 4-15 second 2K MP4 from data.output[0].url.

You need one thing:

  1. A hiapi API key — create one in the dashboard. Send it as a Bearer token on every request.

Everything else — model routing, task polling, output storage — goes through the same unified async task API that every hiapi model uses, so this flow transfers directly if you swap in a different model id.

The minimal working request (curl)

Create the task:

curl -X POST https://api.hiapi.ai/v1/tasks \
  -H "Authorization: Bearer sk-<your-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-h3",
    "input": {
      "prompt": "A paper kite drifting gently above a green field under soft daylight, stable camera, no text."
    }
  }'

Three things worth knowing before you send it:

  • model is the bare id minimax-h3 — no vendor prefix, no version suffix.
  • input.prompt is the only required field. Leave everything else out and you get the defaults: 5 seconds, native 2K resolution, 16:9 aspect ratio, no watermark.
  • input.duration is an integer number of seconds from 4 to 15. Send 99 and the API answers invalid input: duration: maximum: got 99, want 15.

The create response is a small envelope; the field you need is data.taskId. Poll it:

curl -s https://api.hiapi.ai/v1/tasks/<taskId> \
  -H "Authorization: Bearer sk-<your-key>"

Read data.status. "success" and "fail" are the only terminal states — anything else means keep polling. On success, the clip lives at data.output[0].url.

Output URLs are signed and carry an expireAt. Download the MP4 to your own storage as soon as the task succeeds; don't hotlink the temp URL or store it for later.

The same flow in Python

import time
import requests

API = "https://api.hiapi.ai/v1/tasks"
KEY = "sk-<your-key>"
HEADERS = {"Authorization": f"Bearer {KEY}"}

payload = {
    "model": "minimax-h3",
    "input": {
        "prompt": "A paper kite drifting gently above a green field under soft daylight, stable camera, no text.",
        "duration": 6,
    },
}

resp = requests.post(API, json=payload, headers=HEADERS, timeout=60)
resp.raise_for_status()
task_id = resp.json()["data"]["taskId"]
print("task created:", task_id)

deadline = time.time() + 600  # video tasks can take a few minutes
while time.time() < deadline:
    task = requests.get(f"{API}/{task_id}", headers=HEADERS, timeout=30).json()["data"]
    status = task.get("status")
    if status == "success":
        video_url = task["output"][0]["url"]  # signed URL with expireAt
        clip = requests.get(video_url, timeout=120).content
        with open("minimax-h3-clip.mp4", "wb") as f:
            f.write(clip)
        print("saved minimax-h3-clip.mp4")
        break
    if status == "fail":
        err = task.get("error") or {}
        raise RuntimeError(f"task failed: {err.get('code')}: {err.get('message')}")
    time.sleep(5)
else:
    raise TimeoutError("task did not finish within 10 minutes")

Three modes, one model ID

minimax-h3 picks its mode from which input fields you populate — don't mix fields from different modes in one request:

ModeFieldsNotes
Text-to-videoprompt, duration, aspect_ratioDefault mode; just send a prompt
First/last-frame controlfirst_frame_image, last_frame_imagelast_frame_image requires first_frame_image to also be set
Multimodal referenceimage_urls, video_urls, audio_urlsUp to 5 images, 3 videos (2-15s each), 3 audio clips; audio alone isn't valid — pair it with at least one image or video reference

First/last-frame example:

{
  "model": "minimax-h3",
  "input": {
    "prompt": "The camera slowly pushes forward as morning light transitions naturally into golden sunset.",
    "duration": 6,
    "first_frame_image": "https://example.com/first-frame.jpg",
    "last_frame_image": "https://example.com/last-frame.jpg"
  }
}

Multimodal reference example:

{
  "model": "minimax-h3",
  "input": {
    "prompt": "Keep the reference subject consistent and follow the camera rhythm of the reference clip for a polished product showcase.",
    "duration": 8,
    "image_urls": ["https://example.com/product.jpg"],
    "video_urls": ["https://example.com/camera-motion.mp4"],
    "audio_urls": ["https://example.com/rhythm.mp3"]
  }
}

All three modes take public HTTPS URLs, not file uploads — host any local files on a CDN or object storage first.

Production notes: callbacks, idempotency, and real errors

Callbacks instead of polling. For anything beyond ad hoc scripts, add a top-level callback object to the create request instead of polling:

{
  "model": "minimax-h3",
  "input": { "prompt": "A paper kite drifting gently above a green field under soft daylight." },
  "callback": { "url": "https://your-server.example.com/hooks/hiapi", "when": "final" }
}

callback.when only supports "final" — you get one call when the task reaches a terminal state, covering both success and failure. Treat delivery as at-least-once: key your handler on taskId and make it idempotent, and keep a slow polling loop as a fallback in case a callback is missed.

Errors you'll actually see:

ResponseMeaningWhat to do
401 permission_deniedKey is invalid or can't use this modelCheck the key in the dashboard; the error includes a request_id for support
400 INVALID_REQUESTInput failed validationThe message names the exact field, e.g. duration: maximum: got 99, want 15 — fix and resend
400 INVALID_REQUEST (frame combo)last_frame_image sent without first_frame_imageSet first_frame_image, or drop last_frame_image if you only need a starting frame
400 MODEL_UNAVAILABLEModel id doesn't exist or was removedDouble-check the bare model id against the model page
503 TEMPORARILY_UNAVAILABLETransient upstream issue at create timeRetry with backoff — no task was created, so retrying is safe
task status: "fail"Generation itself failedRead data.error.code / message; failed tasks are safe to resubmit

Retries are cheap before create, careful after. A 400/503 at create time means no task exists yet — retry freely. Once you have a taskId, poll or wait for the callback instead of blind-resubmitting, or you can end up paying for duplicate generations.

Related pages

  • minimax-h3 model page — parameters, pricing, and playground
  • Unified Async API introduction — the task create/poll flow every model shares
  • Authentication — API key setup and header format
  • Pricing — current per-generation video pricing
  • Hailuo 2.3 text-to-video via the same API — a second native text-to-video recipe if you want to compare models

FAQ

How long can the generated video be? duration accepts integers from 4 to 15 seconds, defaulting to 5. Values outside that range are rejected at create time with a 400 that names the limit.

What resolution does minimax-h3 generate at? Native 2K only — it's currently the sole supported value for input.resolution.

Can I control the first and last frame of the clip? Yes. Set first_frame_image for the opening frame, and optionally last_frame_image for the closing frame — but last_frame_image requires first_frame_image to be set too.

Can I combine frame control with reference images? No. Frame-control fields (first_frame_image, last_frame_image) and reference-media fields (image_urls, video_urls, audio_urls) are separate modes — mixing them isn't supported.

Do I have to poll, or can I get pushed a result? Both work. Polling GET /v1/tasks/<taskId> is simplest for scripts; for production, add callback: {"url": ..., "when": "final"} and receive one POST when the task reaches a terminal state.

How long is the output URL valid? It's a signed URL with an expireAt timestamp. Download the file immediately after status turns "success" and store it yourself.

What does it cost? Video models are priced per generation depending on duration and settings — see the current numbers on the pricing page.

Latest models

View all models
  • GPT Image 2From $0.007/image
  • Nano Banana 2From $0.051/image
  • Seedream 5.0 ProFrom $0.050/image
  • Seedance 2.5From $0.121/s

Explore models

TextImageVideoAudio
Back to blog
GPT Image 2From $0.007/image
Nano Banana 2From $0.051/image
Seedream 5.0 ProFrom $0.050/image
Seedance 2.5From $0.121/s
View all models
TextChat and reasoning
ImageGenerate and edit
VideoText and image to video
AudioSpeech and music
Start generating
View model pricing
View all articles
How to Use the flux-3 API for Text-to-Video, Audio, and Continuation

How to Use the flux-3 API for Text-to-Video, Audio, and Continuation

minimax-music-3 API: curl & Python Guide

minimax-music-3 API: curl & Python Guide

How to use grok-imagine-image-2.0/image-to-image via the hiapi API: curl, Python, and a working request

How to use grok-imagine-image-2.0/image-to-image via the hiapi API: curl, Python, and a working request

How to Use grok-imagine-image-2.0/text-to-image via the hiapi API: curl, Python, and a Working Request

How to Use grok-imagine-image-2.0/text-to-image via the hiapi API: curl, Python, and a Working Request

How to Use the qwen-image-3.0 API: curl, Python, and a Working Request

How to Use the qwen-image-3.0 API: curl, Python, and a Working Request

How to Use qwen-image-3.0-pro via the hiapi API: curl, Python, and a Working Request

How to Use qwen-image-3.0-pro via the hiapi API: curl, Python, and a Working Request

Start generating