Developer documentationQuickstart

Quickstart

Use the Ark-compatible video task API for H3 text-to-video and image-to-video generation.

1. Prepare an API key

Create an application key in the console. An administrator configures model access and request limits. All keys in an account share usage and limits.

Manage API keys

2. Install the SDK and configure your environment

Terminal · Verified SDK version
pip install 'volcengine-ark-runtime==5.0.55'

export ARK_API_KEY='YOUR_API_KEY'
Base URLhttps://fablun.com/api/v3

Use the Ark Python SDK's Ark client and set base_url to the address above. Set the key with the environment variable ARK_API_KEY.

3. Generate your first video

Python · Create and poll automatically
import os, time, uuid
from volcenginesdkarkruntime import Ark

client = Ark(
    api_key=os.environ["ARK_API_KEY"],
    base_url="https://fablun.com/api/v3",
)

request_key = str(uuid.uuid4())  # Generate only for a new task; reuse the saved value for network retries.
print("Idempotency-Key:", request_key)
task = client.content_generation.tasks.create(
    model="h3-pro",
    content=[
        {"type":"text","text":"At dawn, a butterfly lands on a white daisy. Macro shot, soft natural light."}
    ],
    resolution="480p", duration=5, ratio="16:9",
    
    extra_headers={"Idempotency-Key": request_key},
)
print("task_id:", task.id)  # Save the ID; resume polling the same task after a network interruption.

deadline = time.monotonic() + 1800
while time.monotonic() < deadline:
    result = client.content_generation.tasks.get(task_id=task.id)
    if result.status == "succeeded":
        print(result.content.video_url)
        break
    if result.status in ("failed", "expired", "cancelled"):
        raise RuntimeError(result.error or result.status)
    time.sleep(2)
else:
    raise TimeoutError(f"Polling timed out; continue querying the original task: {task.id}")
Get the video from the task ID
The Python example polls automatically and prints content.video_url. The cURL create request returns only an ID. Continue withRetrieve a video task. The video link expires one hour after completion and delivery readiness.

Next steps