Apariencia
Grok Video
Grok video models for short clips from text or image prompts.
API surface
| Operation | Endpoint | Mode |
|---|---|---|
| Video generation task | POST /v1/async/videos/generations | Async only |
Models
| Model id | Notes |
|---|---|
grok-video-3 | Text-to-video and image-to-video. seconds 6 / 10 / 15. |
grok-video-1.5-preview | Image-to-video only (image required). seconds 10 / 15. |
Pricing
Billed as n × seconds × rate(resolution) credits. Default resolution is 720p.
| Model | 480p | 720p |
|---|---|---|
grok-video-3 | 5/sec | 7/sec |
grok-video-1.5-preview | 8/sec | 14/sec |
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | grok-video-3 or grok-video-1.5-preview. |
prompt | string | Yes | 1–2000 characters. |
seconds | integer | Yes | Model-specific allowed values. |
resolution | string | No | 480p or 720p (default). |
n | integer | No | Default 1. |
image | string | string[] | Conditional | Required for grok-video-1.5-preview. |
providerOptions | object | No | Optional model extensions. See providerOptions below. |
providerOptions
| Field | Type | Models | Description |
|---|---|---|---|
aspect_ratio | string | grok-video-3 | 1:1 / 16:9 / 9:16 / 4:3 / 3:4 / 3:2 / 2:3. |
aspect_ratio | string | grok-video-1.5-preview | 16:9 / 9:16. |
metadata | object | grok-video-3 | Opaque passthrough fields. Pixapi does not interpret them. |
Example
bash
curl https://api.pixapi.ai/v1/async/videos/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-video-3",
"prompt": "A skateboarder jumping over a hydrant at golden hour",
"n": 1,
"seconds": 6,
"resolution": "720p",
"providerOptions": {
"aspect_ratio": "16:9"
}
}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/async/videos/generations",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "grok-video-3",
"prompt": "A skateboarder jumping over a hydrant at golden hour",
"n": 1,
"seconds": 6,
"resolution": "720p",
"providerOptions": {
"aspect_ratio": "16:9"
}
},
)
response.raise_for_status()
task = response.json()
print(task["id"])js
const response = await fetch('https://api.pixapi.ai/v1/async/videos/generations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "grok-video-3",
"prompt": "A skateboarder jumping over a hydrant at golden hour",
"n": 1,
"seconds": 6,
"resolution": "720p",
"providerOptions": {
"aspect_ratio": "16:9"
}
}),
});
if (!response.ok) {
throw new Error(await response.text());
}
const task = await response.json();
console.log(task.id);go
package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body := []byte(`{
"model": "grok-video-3",
"prompt": "A skateboarder jumping over a hydrant at golden hour",
"n": 1,
"seconds": 6,
"resolution": "720p",
"providerOptions": {
"aspect_ratio": "16:9"
}
}`)
req, err := http.NewRequest(
"POST",
"https://api.pixapi.ai/v1/async/videos/generations",
bytes.NewBuffer(body),
)
if err != nil {
panic(err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}Response
Pixapi returns a submitted task. Poll GET /v1/tasks/{id} for the final result.
