GRGlobalRouter Docs
Console

Task / POST

Create task

Creates a unified async task.

POST /v1/tasks

Used to submit async tasks directly in advanced scenarios. For regular video generation, prefer /v1/videos/generations.

Back to Task endpoint list

Request parameters

FieldTypeRequiredDescription
typestringYesTask type, such as video_generation or audio_generation.
modelstringYesModel ID used by the task.
capabilitystringNoTask capability tag.
inputobjectYesTask input; fields vary by task type.
optionsobjectNoTask options.
response_modeobjectNoResponse mode, such as webhook configuration.
routingobjectNoRouting preference, such as provider or strategy tags.
webhook_urlstringNoCallback URL after the task ends.
metadataobjectNoApplication metadata.
priorityintegerNoTask priority from 0 to 10.
idempotency_keystringNoIdempotency key in the request body; the Idempotency-Key header may also be used.
Idempotency-KeyheaderNoIdempotency key to avoid duplicate task creation during client retries.

Request examples

Create task request examples
curl "https://api.globalrouter.com/v1/tasks" \
  -H "Authorization: Bearer $GR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "video_generation",
    "model": "seedance-video",
    "capability": "video_generation",
    "input": { "prompt": "城市天台日落", "duration": 5 },
    "options": { "aspect_ratio": "16:9" },
    "response_mode": {
      "webhook": { "url": "https://example.com/webhooks/gr-task" }
    },
    "routing": { "provider": "doubao" },
    "webhook_url": "https://example.com/webhooks/gr-task",
    "metadata": { "project": "docs-demo" },
    "priority": 5,
    "idempotency_key": "task-demo-001"
  }'

Response fields

FieldTypeRequiredDescription
idstringYesTask ID.
objectstringYesAlways task.
statusstringYesTask status.
progressnumberYesTask progress, from 0 to 1.
progress_detailobjectNoDetailed progress information.
typestringYesTask type.
capabilitystringNoTask capability tag.
modelstringYesModel ID used by the task.
inputobjectYesTask input snapshot.
outputarrayNoArtifact list after task success.
resultobjectNoProvider result summary.
errorobjectNoError information when the task fails.
usageobjectNoUsage and billing details.
attemptobjectYesRetry count summary, including current and max.
linksobjectNoQuery, cancellation, or event subscription URL.
providerstringNoProvider that executed the task.
cost_usdnumberNoTask cost.
billing_model_keystringNoBilling model key.
discount_idstringNoDiscount ID.
discount_factornumberYesDiscount factor.
list_costnumberYesList-price cost before discounts.
discount_amountnumberYesDiscount amount.
actual_costnumberYesActual charge.
webhook_urlstringNoTask callback URL.
metadataobjectNoApplication metadata.
priorityintegerYesTask priority.
started_atstringNoTask start time.
finished_atstringNoTask end time.
completed_atstringNoTask completion time.
canceled_atstringNoTask cancellation time.
created_atstringYesTask creation time.
updated_atstringYesTask update time.

Response example

Response example
{
  "id": "task_01HV...",
  "object": "task",
  "type": "video_generation",
  "status": "queued",
  "progress": 0,
  "progress_detail": {},
  "model": "seedance-video",
  "input": { "prompt": "城市天台日落", "duration": 5 },
  "output": null,
  "result": null,
  "error": null,
  "usage": null,
  "attempt": { "current": 1, "max": 3 },
  "links": { "self": "/v1/tasks/task_01HV..." },
  "provider": "doubao",
  "metadata": { "project": "docs-demo" },
  "priority": 5,
  "created_at": "2026-06-26T10:00:00Z",
  "updated_at": "2026-06-26T10:00:00Z"
}

Errors

HTTPCodeDescription
401UNAUTHORIZEDMissing or invalid Authorization Bearer token.
403FORBIDDENThe current API key is not allowed to call this scope or model.
429RATE_LIMITEDRequests are too frequent or the asynchronous task queue is full; reduce concurrency or retry later.