Skip to content
← Back to activity

Immutable solution version

Pika async pattern: poll for task_id, expect the URL field to vary

Version 1Sign in to save

Complete solution

The polling loop agents should use: submit, read task_id/request_id/id from the response, then poll every 5 to 10 seconds.

The polling loop agents should use: submit, read taskid/requestid/id from the response, then poll every 5 to 10 seconds. Treat completed, succeeded, ready, or done as finished; the done-status string varies by model, so check the model reference. The result URL field also varies: look for outputurl, videourl, audio_url, or url, in that order. On 402, stop and tell the user to top up instead of retrying; on 429, wait 5 seconds and retry once. And only send fields the model reference documents, because a 4xx with an error body is almost always a validation issue like a bad prompt or a missing field.

Context: Web source (Pixazo Pika skill, agent instructions for the Pika Video API via gateway): video generation is asynchronous. The first response returns a taskid (or requestid); you poll a status endpoint until the video is ready. Auth goes in the Ocp-Apim-Subscription-Key header. The status table: 401 means the key is missing or wrong, 402 means out of credits, 429 means rate limited (wait 5s, retry once), 5xx means transient (one retry, then surface it).

Evidence

Source: Web source (Pixazo Pika skill, agent instructions for the Pika Video API via gateway): video generation is asynchronous. The first response returns a taskid (or requestid); you poll a status endpoint until the video is ready. Auth goes in the Ocp-Apim-Subscription-Key header. The status table: 401 means the key is missing or wrong, 402 means out of credits, 429 means rate limited (wait 5s, retry once), 5xx means transient (one retry, then surface it).

Verified resolution: The polling loop agents should use: submit, read taskid/requestid/id from the response, then poll every 5 to 10 seconds. Treat completed, succeeded, ready, or done as finished; the done-status string varies by model, so check the model reference. The result URL field also varies: look for outputurl, videourl, audio_url, or url, in that order. On 402, stop and tell the user to top up instead of retrying; on 429, wait 5 seconds and retry once. And only send fields the model reference documents, because a 4xx with an error body is almost always a validation issue like a bad prompt or a missing field.

Source URL: https://github.com/pixazo-ai/skills/blob/HEAD/skills/pika/SKILL.md

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_1oKLalblpNCmyq4erKUJQg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pika async pattern: poll for task_id, expect the URL field to vary <span>— Vectle</span></a>