Video Generation API Guide
Create text-to-video or image-to-video tasks with the GetToken Video API, then download results through the authenticated content endpoint.
The GetToken Video API provides Grok text-to-video and image-to-video generation. Video generation is asynchronous: create a task, query its status, and then retrieve the video file through the content endpoint.
Every request requires a dedicated service_type=video_api API key. Video keys are managed separately from text and image keys and cannot be used interchangeably.
Prerequisites
- Sign in to the GetToken console.
- Create a dedicated video API key from Console → Video API.
- Review
base_urland endpoint selection in base_url & endpoint selection.
The examples below use:
base_url: https://api.gettoken.devEndpoints
| Method | Path | Purpose |
|---|---|---|
| POST | /v1/videos/generations | Create a video generation task |
| GET | /v1/videos/{task_id} | Query task status |
| GET | /v1/videos/{task_id}/content | Retrieve the video file |
The current documented contract covers video generation, status queries, and content downloads. Video editing and extension are outside the scope of this guide.
Models and Input Modes
| Model | Text-to-video | Image-to-video | Reference image |
|---|---|---|---|
grok-imagine-video | Supported | Supported | Optional |
grok-imagine-video-1.5-preview | Not supported | Supported | Required |
Image-to-video is an input mode for video generation. It does not expose a separate image generation API.
Generation Parameters
| Field | Required | Description |
|---|---|---|
model | Yes | One of the documented model IDs above |
prompt | Yes | A description of the video to generate |
seconds | Yes | 1–15 seconds; a string such as "8" is recommended |
size | Yes | An explicit width and height from the table below |
image_url | Required for image-to-video | A top-level public HTTPS URL or Data URL |
Supported Sizes
size | Orientation and quality |
|---|---|
1280x720 | 720p landscape |
720x1280 | 720p portrait |
1792x1024 | 1080p landscape |
1024x1792 | 1080p portrait |
The current documented sizes do not include 480p.
Reference images may use JPEG, PNG, or WebP. A single image may be up to 60 MiB, and the complete request body may be up to 96 MiB. Public image URLs must be directly accessible over HTTPS.
Create a Text-to-Video Task
curl --fail https://api.gettoken.dev/v1/videos/generations \
-H "Authorization: Bearer YOUR_VIDEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video",
"prompt": "A quiet city street after rain",
"seconds": "8",
"size": "1280x720"
}'Create an Image-to-Video Task
curl --fail https://api.gettoken.dev/v1/videos/generations \
-H "Authorization: Bearer YOUR_VIDEO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-video-1.5-preview",
"prompt": "Move the subject forward while the camera slowly pushes in",
"seconds": "8",
"size": "1280x720",
"image_url": "https://example.com/reference.webp"
}'After the task is created, prefer the top-level id from the response and use it as task_id in subsequent requests. Compatibility responses may also include request_id or task_id.
Query Task Status
curl --fail \
-H "Authorization: Bearer YOUR_VIDEO_API_KEY" \
https://api.gettoken.dev/v1/videos/TASK_IDThe documented statuses are:
| Status | Client action |
|---|---|
pending | The task is still running; continue polling |
done | The task is complete; call the content endpoint |
expired | Stop polling and inspect the returned error |
Poll every 5–10 seconds. A five-minute overall client timeout is a reasonable default.
When a task is complete, the status response may look like this:
{
"id": "TASK_ID",
"status": "done",
"video": {
"url": "/v1/videos/TASK_ID/content",
"duration": 8
}
}video.url is an authenticated content endpoint, not video bytes embedded in the JSON response. The client must make a separate HTTP request with its API key to retrieve the file.
Download Video Through the Content Endpoint
The status endpoint returns task metadata, not the video file. After the task reaches
done, you must request/v1/videos/{task_id}/contentto retrieve the video bytes.
Use the same video API key that created the task:
curl --fail \
-H "Authorization: Bearer YOUR_VIDEO_API_KEY" \
https://api.gettoken.dev/v1/videos/TASK_ID/content \
--output grok-video.mp4Do not depend directly on an upstream signed URL from the status response. The GetToken content endpoint retrieves the official video server-side and returns it as a video/mp4 byte stream. This keeps authentication consistent and avoids requiring the client to connect directly to the upstream video host.
The content endpoint supports HTTP Range. Players, resumable downloads, and segmented clients may send a Range header:
curl --fail \
-H "Authorization: Bearer YOUR_VIDEO_API_KEY" \
-H "Range: bytes=0-" \
https://api.gettoken.dev/v1/videos/TASK_ID/content \
--output grok-video.mp4The response may include:
Content-Type: video/mp4Accept-Ranges: bytesContent-LengthContent-Rangefor partial responses
Status queries and content downloads are not billed again. The content endpoint still validates task ownership and API key permissions, so Authorization is required and another key cannot be substituted.
Pricing and Retention
Video is billed by actual generated duration. See Console → Video API for real-time quotes. You can estimate the cost by model, quality, and duration before submitting, while the usage record remains the final billing reference.
GetToken retains video results for 24 hours. After a task reaches done, promptly save the result to your own storage through the content endpoint.
Notes
- If a creation response is uncertain, do not automatically resubmit through another account; doing so may create and bill duplicate tasks.
grok-imagine-video-1.5-previewrequiresimage_url.- Status and content requests must use the same video API key that created the task.
- Cancellation, batch generation, and multiple reference images are not currently available.