# Define model como "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
Generación de video Grok Imagine 1.5
- Modo de procesamiento asíncrono, devuelve un ID de tarea para consultas posteriores
- Generación de video con IA de alta calidad, admite text-to-video e image-to-video
- Opciones flexibles de relación de aspecto y calidad para distintas necesidades creativas
POST
/
v1
/
videos
/
generations
# Define model como "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"
}
}
Nombre del modelo: usa
grok-imagine-1.5-video-ext en este endpoint.# Define model como "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"
}
}
Autorizaciones
string
requerido
Todas las APIs requieren autenticación mediante Bearer TokenObtener API Key:Visite la página de gestión de API Keys para obtener su API KeyAñádala al encabezado de la solicitud:
Authorization: Bearer YOUR_API_KEY
Parámetros de la solicitud
string
predeterminado:"grok-imagine-1.5-video-ext"
requerido
Nombre del modelo de generación de videoModelos compatibles:
grok-imagine-1.5-video-ext- Generación de vídeo Grok
"grok-imagine-1.5-video-ext"Usa siempre
grok-imagine-1.5-video-ext en las solicitudes nuevas.boolean
predeterminado:"false"
Indica si se debe moderar el contenido antes de enviar la tarea de vídeo.
true: revisar los prompts y las imágenes de entrada conomni-moderation-latestfalseu omitido: no enviar una solicitud de moderación, sin coste ni latencia de moderación adicionales (predeterminado)
string
requerido
Descripción del contenido del video, admite múltiples idiomas
string
predeterminado:"16:9"
Tamaño del videoOpciones:
16:9- Horizontal (predeterminado)9:16- Vertical1:1- Cuadrado3:2- Horizontal2:3- Vertical
integer
predeterminado:6
Duración del video (segundos)Rango: 6-15 (mínimo 6 segundos, máximo 15 segundos)⚠️ Nota: Debe ser un número simple (por ejemplo,
6), sin comillas, de lo contrario se producirá un errorstring
predeterminado:"480p"
Calidad del videoOpciones:
480p- Definición estándar (predeterminado)720p- Alta definición
string[]
Lista de URLs de imágenes de referenciaLímites:
- Máximo 7 imágenes
- Deben ser URLs de acceso público
- No se admite el formato Base64
Tras subir una imagen de referencia, la relación de aspecto coincidirá automáticamente con la de la imagen de referencia.
Respuesta
integer
Código de estado de la respuesta
object[]
Consultar el resultado de la tareaLa generación de video es una tarea asíncrona. Tras la solicitud, se devolverá un
task_id. Use el endpoint Obtener estado de la tarea para consultar el progreso y los resultados de la generación.Casos de uso
Caso 1: Texto a video
{
"model": "grok-imagine-1.5-video-ext",
"prompt": "A dog running on the beach, sunny weather, slow motion",
"size": "16:9",
"duration": 6
}
Caso 2: Imagen a 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"
}