The CometAPI Vidu content endpoint returns a video file

When a Vidu task reaches completed, CometAPI gives you a different kind of response to handle: the content operation returns the generated video as video/mp4, not another JSON task record.

That distinction makes the client flow simple, but important:

  1. Create the Vidu task through CometAPI and retain its task ID.
  2. Read the task metadata and poll until the task status is completed.
  3. Call GET /v1/videos/{id}/content with that same ID.
  4. On the successful branch, stream or save the response bytes as an MP4. Do not send the success body through a JSON parser.

The content endpoint is therefore a media-download step, not a second status lookup. Keep the task ID as the durable link between the metadata you polled and the file you store. In a streaming client, check the response status and content type before opening the destination, then write the body without decoding it as text.

There is also an incomplete-task branch to account for. If the Vidu task is still running, the endpoint returns a JSON error rather than video bytes. Treat that response as a signal to continue the task-status workflow; do not create a partial MP4 from it. The documentation does not prescribe a polling interval or retry schedule, so choose those operational policies separately for your application.

The practical parser boundary is: task metadata and an incomplete-task error are JSON, while the successful content response is binary video/mp4. Keeping those branches explicit prevents a successful CometAPI download from being lost to a JSON-only response handler.

A useful implementation detail is to make the download boundary explicit in the media pipeline, not just in the HTTP client. Keep the task ID and the eventual file as separate pieces of state: the ID is the provenance link, while the response body is an opaque byte stream until the response has passed status and Content-Type checks.

For a renderer or asset-ingest step, that means a successful video/mp4 response can be written to a temporary file and finalized only after the stream completes. The still-running JSON error branch should remain a structured task event and never enter the media queue. This separation also gives downstream thumbnail extraction or transcoding a clear contract: they consume a completed MP4 artifact, not whichever body happened to come back from the content endpoint.