Interface grok-imagine-image-to-video
curl --request POST \
--url https://api.evolink.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-image-to-video-beta",
"prompt": "The person starts dancing",
"image_urls": [
"https://example.com/image.jpg"
],
"duration": 6,
"mode": "normal",
"quality": "480p"
}
'import requests
url = "https://api.evolink.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-image-to-video-beta",
"prompt": "The person starts dancing",
"image_urls": ["https://example.com/image.jpg"],
"duration": 6,
"mode": "normal",
"quality": "480p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'grok-imagine-image-to-video-beta',
prompt: 'The person starts dancing',
image_urls: ['https://example.com/image.jpg'],
duration: 6,
mode: 'normal',
quality: '480p'
})
};
fetch('https://api.evolink.ai/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evolink.ai/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-imagine-image-to-video-beta',
'prompt' => 'The person starts dancing',
'image_urls' => [
'https://example.com/image.jpg'
],
'duration' => 6,
'mode' => 'normal',
'quality' => '480p'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evolink.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evolink.ai/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evolink.ai/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757169743,
"id": "task-unified-1757169743-7cvnl5zw",
"model": "grok-imagine-image-to-video-beta",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 120
},
"type": "video",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 4.8
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: grok-imagine-image-to-video-beta",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}Grok
Grok Imagine Image vers Vidéo Beta
- Le modèle Grok Imagine (grok-imagine-image-to-video-beta) prend en charge le mode image vers vidéo
- Mode de traitement asynchrone, utiliser l’ID de tâche retourné pour interroger
- Les liens vidéo générés sont valides pendant 7 jours, veuillez les sauvegarder rapidement
- Dans de rares cas, les résultats générés sont fournis via les liens d’origine officiels, qui peuvent expirer en moins de 7 jours. Téléchargez et enregistrez vos résultats rapidement.
POST
/
v1
/
videos
/
generations
Interface grok-imagine-image-to-video
curl --request POST \
--url https://api.evolink.ai/v1/videos/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "grok-imagine-image-to-video-beta",
"prompt": "The person starts dancing",
"image_urls": [
"https://example.com/image.jpg"
],
"duration": 6,
"mode": "normal",
"quality": "480p"
}
'import requests
url = "https://api.evolink.ai/v1/videos/generations"
payload = {
"model": "grok-imagine-image-to-video-beta",
"prompt": "The person starts dancing",
"image_urls": ["https://example.com/image.jpg"],
"duration": 6,
"mode": "normal",
"quality": "480p"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'grok-imagine-image-to-video-beta',
prompt: 'The person starts dancing',
image_urls: ['https://example.com/image.jpg'],
duration: 6,
mode: 'normal',
quality: '480p'
})
};
fetch('https://api.evolink.ai/v1/videos/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.evolink.ai/v1/videos/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-imagine-image-to-video-beta',
'prompt' => 'The person starts dancing',
'image_urls' => [
'https://example.com/image.jpg'
],
'duration' => 6,
'mode' => 'normal',
'quality' => '480p'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.evolink.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.evolink.ai/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evolink.ai/v1/videos/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"grok-imagine-image-to-video-beta\",\n \"prompt\": \"The person starts dancing\",\n \"image_urls\": [\n \"https://example.com/image.jpg\"\n ],\n \"duration\": 6,\n \"mode\": \"normal\",\n \"quality\": \"480p\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757169743,
"id": "task-unified-1757169743-7cvnl5zw",
"model": "grok-imagine-image-to-video-beta",
"object": "video.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 120
},
"type": "video",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 4.8
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: grok-imagine-image-to-video-beta",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}Autorisations
##Toutes les API nécessitent une authentification Bearer Token##
Obtenir une clé API :
Visitez la Page de gestion des clés API pour obtenir votre clé API
Ajouter à l'en-tête de requête :
Authorization: Bearer YOUR_API_KEY
Corps
application/json
Nom du modèle
Rétrocompatible : Le nom de modèle précédemment intégré grok-imagine-image-to-video reste utilisable et est automatiquement mappé vers grok-imagine-image-to-video-beta
Options disponibles:
grok-imagine-image-to-video-beta Exemple:
"grok-imagine-image-to-video-beta"
Rapport d'aspect (effectif uniquement en mode multi-images ; en mode image unique, la taille de la vidéo suit l'image d'entrée)
Options :
16:9: Paysage (par défaut)9:16: Portrait1:1: Carré3:2: Paysage 3:22:3: Portrait 2:3
Options disponibles:
16:9, 9:16, 1:1, 3:2, 2:3 Exemple:
"16:9"
URL de rappel HTTPS après l'achèvement de la tâche
Moment du rappel :
- Déclenché lorsque la tâche est terminée, échouée ou annulée
- Envoyé après confirmation de la facturation
Restrictions de sécurité :
- Seul le protocole HTTPS est pris en charge
- Rappel vers les IP internes interdit (127.0.0.1, 10.x.x.x, 172.16-31.x.x, 192.168.x.x, etc.)
- La longueur de l'URL ne doit pas dépasser
2048caractères
Mécanisme de rappel :
- Délai d'expiration :
10secondes - Maximum
3tentatives en cas d'échec (après1/2/4secondes) - Le format de réponse correspond à l'API d'interrogation de tâche
- Code de statut 2xx = succès, les autres déclenchent une nouvelle tentative
Exemple:
"https://your-domain.com/webhooks/video-task-completed"
Réponse
Tâche vidéo créée avec succès