Skip to main content
POST
/
videos
/
generations
Create video generation
curl --request POST \
  --url https://dimilinks.com/v1/videos/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "grok-imagine-video",
  "prompt": "<string>",
  "input_reference": [
    "<string>"
  ],
  "group": "<string>"
}
'
import requests

url = "https://dimilinks.com/v1/videos/generations"

payload = {
"model": "grok-imagine-video",
"prompt": "<string>",
"input_reference": ["<string>"],
"group": "<string>"
}
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-video',
prompt: '<string>',
input_reference: ['<string>'],
group: '<string>'
})
};

fetch('https://dimilinks.com/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://dimilinks.com/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-video',
'prompt' => '<string>',
'input_reference' => [
'<string>'
],
'group' => '<string>'
]),
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://dimilinks.com/v1/videos/generations"

payload := strings.NewReader("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"<string>\",\n \"input_reference\": [\n \"<string>\"\n ],\n \"group\": \"<string>\"\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://dimilinks.com/v1/videos/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"grok-imagine-video\",\n \"prompt\": \"<string>\",\n \"input_reference\": [\n \"<string>\"\n ],\n \"group\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://dimilinks.com/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-video\",\n \"prompt\": \"<string>\",\n \"input_reference\": [\n \"<string>\"\n ],\n \"group\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx"
  }
}
{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}
{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}
{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}
{
"error": {
"message": "<string>",
"type": "invalid_request_error",
"code": "<string>"
}
}
/v1/videos/generations returns a task_id immediately after submission. Generation time depends on duration and resolution, and is generally one to five minutes. Poll /v1/tasks/{task_id} for status.
The video endpoint currently supports only the grok-imagine-video model. Inference and billing use the special pricing for the Grok route.

Request URL

POST https://dimilinks.com/v1/videos/generations
Content-Type: application/json
Authorization: Bearer <DIMILINKS_API_KEY>

Text-to-video example

curl "https://dimilinks.com/v1/videos/generations" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "A group of neon jellyfish drifting slowly through the deep sea in cinematic light",
    "seconds": "6",
    "size": "1280x720",
    "resolution_name": "720p",
    "preset": "normal"
  }'
Successful response:
{
  "data": {
    "id": "video_xxx",
    "task_id": "video_xxx",
    "status": "queued"
  }
}
After receiving task_id, call Retrieve video task.

Reference-image-to-video example

Convert reference images to data:image/...;base64,... Data URLs first. Browser blob: URLs cannot be submitted directly; your server must read the binary data and encode it.
curl "https://dimilinks.com/v1/videos/generations" \
  -H "Authorization: Bearer $DIMILINKS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "grok-imagine-video",
    "prompt": "Keep the person consistent while the camera makes one complete orbit around the subject",
    "seconds": "10",
    "size": "1280x720",
    "resolution_name": "720p",
    "preset": "normal",
    "input_reference": [
      "data:image/png;base64,iVBORw0KGgo..."
    ]
  }'

Parameters

ParameterTypeRequiredDescription
modelstringYesCurrently fixed to grok-imagine-video.
promptstringYesVideo description, up to 2,500 characters.
secondsstringYesDuration in seconds: "6" / "10" / "12" / "16" / "20".
sizestringYesFrame size: 1280x720 (16:9), 720x1280 (9:16), or 1024x1024 (1:1).
resolution_namestringYesResolution tier: 720p (HD) or 480p (SD).
presetstringYesStyle preset: normal (standard), fun (high playfulness), spicy (high intensity), or custom (custom prompt).
input_referencestring[]NoArray of up to seven reference-image Data URLs. When provided, enables reference-image-to-video mode.
groupstringNoRoute group. Console requests include default; third-party callers generally leave it empty.

Duration and resolution combinations

  • Use 720p for final output. 480p generates faster and is suitable for previews.
  • Longer durations increase generation time and price. Start with seconds: "6" to validate the workflow.
  • When changing the same prompt to 9:16 or 1:1, describe where the subject should appear in the frame to avoid cropping.

Error handling

The video endpoint also uses the OpenAI-style error wrapper. See Errors for common errors. If a 400 response reports a reference-image problem, verify that:
  • The reference image is PNG, JPEG, or WebP.
  • It uses a Data URL, not a blob: URL or regular HTTP URL.
  • Each reference image is smaller than 10 MB.
  • The request includes no more than seven reference images.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
model
string
default:grok-imagine-video
required
prompt
string
required
Maximum string length: 2500
seconds
enum<string>
required
Available options:
6,
10,
12,
16,
20
size
enum<string>
required
Available options:
1280x720,
720x1280,
1024x1024
resolution_name
enum<string>
required
Available options:
480p,
720p
preset
enum<string>
required
Available options:
normal,
fun,
spicy,
custom
input_reference
string[]
Maximum array length: 7

data:image/...;base64,... Data URL

group
string

Response

Video task submission

data
object