Skip to content
English

Python SDK

The official Python client for HiAPI wraps the unified async task API so you can submit a generation task, wait for it to finish, and read its output in a single call.

  • Package: hiapi on PyPI · Source on GitHub
  • Zero runtime dependencies — standard library only.
  • Python 3.8+, fully typed (ships py.typed).
  • Built-in webhook signature verification.
Terminal window
pip install hiapi

Submit a task, follow its progress, and read the result:

from hiapi import HiAPI
client = HiAPI(api_key="sk-...") # or set HIAPI_API_KEY
task = client.tasks.run(
model="seedance-2-0",
input={"prompt": "a cyan glass data center entrance", "resolution": "1080p"},
on_update=lambda t: print(t.status),
)
for out in task.output:
print(out.type, out.url)

client.tasks.run() submits the task and blocks until it reaches a terminal state. For the lower-level create, retrieve, list, and wait methods, webhook verification, the exception hierarchy, and client configuration, see the README.