Skip to main content
POST
/
grok
/
v1
/
videos
/
edits
Create an xAI video edit job
curl --request POST \
  --url https://api.cometapi.com/grok/v1/videos/edits \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "prompt": "Add snow to the scene.",
  "video": {
    "url": "https://example.com/source.mp4"
  }
}
'
{
  "request_id": "e55813f7-911f-cfa8-208c-9c8e693b4d38"
}
Use this endpoint to edit an existing MP4 with a text instruction. The output stays closer to the source clip’s timing and composition than a fresh generation request.

Before you send the request

  • Provide a reachable video.url
  • Keep the source clip short; xAI’s own guidance caps edits at about 8.7 seconds
  • Use a focused instruction that describes one clear change
  • Save the returned request_id, because edits use the same polling flow as generation

Editing flow

1

Submit the edit request

Send the source video URL, edit prompt, and model: grok-imagine-video.
2

Poll for the final result

Call Get Video Generation Results until the job is finished.
3

Store the edited asset

Download the finished output or move the returned URL into your own storage pipeline.

What changes on CometAPI

xAI documents video editing as the same async lifecycle as generation, just with a source video instead of an optional source image. CometAPI keeps that behavior and the same polling endpoint, so your edit workflow is still start -> poll -> download.

Authorizations

Authorization
string
header
required

Bearer token authentication. Use your CometAPI key.

Body

application/json
prompt
string
required

Edit instruction describing the change you want.

Example:

"Add snow to the scene."

video
object
required

Source video to edit. xAI documents an input limit of about 8.7 seconds.

model
string
default:grok-imagine-video

xAI video model id.

Example:

"grok-imagine-video"

output
object

Optional output delivery configuration.

user
string

Optional end-user identifier.

Response

200 - application/json

Request accepted.

request_id
string
required

Deferred request id used for polling.