edit_video
Edit an existing video by providing a source URL and a natural language prompt. Works for clips up to 8.7 seconds and preserves the original duration.
Instructions
Edit an existing video using xAI Grok Imagine Video API. Provide a source video URL along with a prompt describing the desired changes. The maximum supported video length is 8.7 seconds. The edited video will have the same duration as the original.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "edit_video"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Model to use (default: grok-imagine-video). grok-imagine-video-1.5 does not support editing and returns "Video editing is not supported for this model.". | |
| prompt | Yes | Description of the desired edits to make to the video | |
| video_url | No | URL of the source video to edit (must be publicly accessible, max 8.7 seconds). Provide exactly one of video_url, video_path, or video_file_id. | |
| video_path | No | Local video file path (.mp4). Uploaded to the xAI Files API automatically. Provide exactly one of video_url, video_path, or video_file_id. | |
| output_path | No | Output file path (default: edited_video.mp4) | |
| video_file_id | No | File ID of the source video from the xAI Files API. Provide exactly one of video_url, video_path, or video_file_id. |