Video tasks

Video tasks

Download Markdown ↓

Submit a generation job, check its progress, then retrieve the result.

Choose an endpoint#

The following workflow is for models supporting the unified video API. Other models may require provider-native task endpoints. Use the endpoints listed in the model details; request bodies are not interchangeable across all models.

1. Submit a task#

Set XINGSUAN_MODEL to a model supporting this endpoint and five-second text-to-video generation. The duration below is an example, not a valid value for every model.

bash
curl 'https://api.xsopc.com/v1/videos' \
  -H "Authorization: Bearer $XINGSUAN_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<JSON
{
  "model": "$XINGSUAN_MODEL",
  "prompt": "A slow camera move through a sunlit forest",
  "seconds": "5"
}
JSON

Save the platform's returned task ID. A successful submission means the job was accepted, not that generation has finished.

2. Query progress#

Replace YOUR_TASK_ID with the returned ID and query with a valid key from the same account.

bash
curl 'https://api.xsopc.com/v1/videos/YOUR_TASK_ID' \
  -H "Authorization: Bearer $XINGSUAN_API_KEY"

Start polling every 3–5 seconds and increase the interval for long jobs. Interpret the returned queued, processing, successful or failed state according to the endpoint's actual schema.

The generic task query is also available below. Its JSON differs from native video queries; do not reuse the same parser blindly.

bash
curl 'https://api.xsopc.com/v1/tasks/YOUR_TASK_ID' \
  -H "Authorization: Bearer $XINGSUAN_API_KEY"

3. Retrieve the result#

When the task succeeds and its model supports this content endpoint, download the video. Otherwise use the results or artifacts returned by the task.

bash
curl --fail --location \
  'https://api.xsopc.com/v1/videos/YOUR_TASK_ID/content' \
  -H "Authorization: Bearer $XINGSUAN_API_KEY" \
  --output result.mp4

Result links and artifacts may expire. Download promptly, keep the necessary authorization, and do not publicly share URLs carrying access credentials.

Image and video references#

For a unified video model supporting a local first-frame upload, the following multipart request is an example. Confirm duration and upload support first.

bash
curl 'https://api.xsopc.com/v1/videos' \
  -H "Authorization: Bearer $XINGSUAN_API_KEY" \
  -F "model=$XINGSUAN_MODEL" \
  -F 'prompt=A slow camera move, preserve the main subject' \
  -F 'seconds=5' \
  -F 'input_reference=@reference.png'

Multiple references, first/last frames and reference videos have different fields and limits. If the upstream accepts only URLs, supply a valid link or use the platform's configured storage and adapter. See Files and references.

Avoid duplicate jobs#

Querying does not resubmit generation. If submission times out, inspect task records before trying again. Duration, resolution, references and generation modes can affect pricing; follow the model's billing rules.

Updated

Search docs