# Set model to "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-ext",
prompt: "A dog running on the beach, sunny weather, slow motion",
size: "16:9",
duration: 6,
resolution: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden, you do not have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error, please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway, server temporarily unavailable",
"type": "bad_gateway"
}
}
Grok Imagine
Grok Imagine 1.5 Video Generation
- Async processing mode, returns task ID for subsequent queries
- High-quality AI video generation, supports text-to-video and image-to-video
- Flexible aspect ratio and quality options for different creative needs
POST
/
v1
/
videos
/
generations
# Set model to "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-ext",
prompt: "A dog running on the beach, sunny weather, slow motion",
size: "16:9",
duration: 6,
resolution: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden, you do not have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error, please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway, server temporarily unavailable",
"type": "bad_gateway"
}
}
Model name: Use
grok-imagine-1.5-video-ext for this endpoint.# Set model to "grok-imagine-1.5-video-ext"
curl --request POST \
--url https://api.apimart.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}'
import requests
url = "https://api.apimart.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6,
"resolution": "720p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/videos/generations";
const payload = {
model: "grok-imagine-1.5-video-ext",
prompt: "A dog running on the beach, sunny weather, slow motion",
size: "16:9",
duration: 6,
resolution: "720p"
};
const headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
{
"code": 200,
"data": [
{
"task_id": "task_01JNXXXXXXXXXXXXXXXXXX",
"status": "submitted"
}
]
}
{
"error": {
"code": 400,
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "Authentication failed, please check your API key",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "Insufficient balance, please top up and try again",
"type": "payment_required"
}
}
{
"error": {
"code": 403,
"message": "Access forbidden, you do not have permission to access this resource",
"type": "permission_error"
}
}
{
"error": {
"code": 429,
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}
{
"error": {
"code": 500,
"message": "Internal server error, please try again later",
"type": "server_error"
}
}
{
"error": {
"code": 502,
"message": "Bad gateway, server temporarily unavailable",
"type": "bad_gateway"
}
}
Authorizations
string
required
All APIs require Bearer Token authenticationGet API Key:Visit the API Key Management Page to get your API KeyAdd it to the request header:
Authorization: Bearer YOUR_API_KEY
Request Parameters
string
default:"grok-imagine-1.5-video-ext"
required
Video generation model nameSupported models:
grok-imagine-1.5-video-ext- Grok Video Generation
"grok-imagine-1.5-video-ext"Use
grok-imagine-1.5-video-ext consistently in new requests.boolean
default:"false"
Whether to run content moderation before submitting the video task.
true: useomni-moderation-latestto review prompts and input imagesfalseor omitted: do not send a moderation request, adding no moderation cost or latency (default)
string
required
Video content description, supports multiple languages
string
default:"16:9"
Video sizeOptions:
16:9- Landscape (default)9:16- Portrait1:1- Square3:2- Landscape2:3- Portrait
integer
default:6
Video duration (seconds)Range: 6-15 (minimum 6 seconds, maximum 15 seconds)⚠️ Note: Must be a plain number (e.g.
6), do not add quotes, otherwise an error will occurstring
default:"480p"
Video qualityOptions:
480p- Standard definition (default)720p- High definition
string[]
List of reference image URLsLimits:
- Maximum 7 images
- Must be publicly accessible URLs
- Base64 format is not supported
After uploading a reference image, the aspect ratio will automatically match the reference image’s aspect ratio.
Response
integer
Response status code
object[]
Query Task ResultVideo generation is an async task. After submission, a
task_id will be returned. Use the Get Task Status endpoint to query generation progress and results.Use Cases
Case 1: Text-to-Video
{
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6
}
Case 2: Image-to-Video
{
"model": "grok-imagine-1.5-video-ext",
"prompt": "Bring the scene to life with natural dynamic effects",
"image_urls": ["https://example.com/start.png"],
"size": "16:9",
"duration": 10,
"resolution": "720p"
}