Skip to content

Vidu API Examples

Vidu series (e.g. Vidu Q3) provides video generation via the Agentsflare gateway using the async endpoints below:

-- Create: POST https://api.agentsflare.com/v1/videos/generations -- Query: GET https://api.agentsflare.com/v1/async-result/{task_id}

  • Auth: Authorization: Bearer <API_KEY>

Vendor reference: Vidu documentation (original): https://zhipu-ai.feishu.cn/wiki/NSH1wPKppiVgsUkeqdccBo0qnAG

Examples below show cURL, Python, Node and Go usage.

Request parameters (summary)

ParameterRequiredDescription
modelYese.g. viduq3-turbo-text2video / viduq3-pro-img2video
promptYesText prompt describing subject and actions
durationYesVideo duration in seconds (commonly 5)
movement_amplitudeOptionalMotion amplitude (low / medium / high)
with_audioOptionalWhether to include/generate audio (true / false)
first_frame_imageConditionalURL for single-frame input (image-to-video)
resolutionOptionalOutput resolution
aspect_ratioOptionalAspect ratio, e.g. 16:9
callback_urlOptionalAsync callback URL
external_task_idOptionalClient-specified task id

Text to Video

Image to Video

bash
curl -X POST "https://api.agentsflare.com/v1/videos/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "viduq3-pro-img2video",
    "prompt": "The man on the left has white light flashing in his glasses",
    "duration": 5,
    "first_frame_image": "https://example.com/first.png"
  }'
python
import requests
import os

API_BASE = 'https://api.agentsflare.com/v1/videos/generations'
API_KEY = os.getenv('API_KEY')

payload = {
  'model': 'viduq3-pro-img2video',
  'prompt': 'The man on the left has white light flashing in his glasses',
  'duration': 5,
  'first_frame_image': 'https://example.com/first.png'
}

headers = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
resp = requests.post(API_BASE, json=payload, headers=headers)
print(resp.status_code)
print(resp.text)
javascript
const fetch = require('node-fetch');
const API_BASE = 'https://api.agentsflare.com/v1/videos/generations';
const API_KEY = process.env.API_KEY;

const payload = {
  model: 'viduq3-pro-img2video',
  prompt: 'The man on the left has white light flashing in his glasses',
  duration: 5,
  first_frame_image: 'https://example.com/first.png'
};

(async () => {
  const res = await fetch(API_BASE, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify(payload)
  });

  console.log(await res.text());
})();
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class ViduImage2V {
  public static void main(String[] args) throws Exception {
    String apiBase = "https://api.agentsflare.com/v1/videos/generations";
    String apiKey = System.getenv("API_KEY");
    String json = "{\"model\":\"viduq3-pro-img2video\",\"prompt\":\"The man on the left has white light flashing in his glasses\",\"duration\":5,\"first_frame_image\":\"https://example.com/first.png\"}";

    HttpRequest req = HttpRequest.newBuilder()
      .uri(URI.create(apiBase))
      .header("Authorization", "Bearer " + apiKey)
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString(json))
      .build();

    HttpResponse<String> resp = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}

Query task

bash
curl -X GET "https://api.agentsflare.com/v1/async-result/<task_id>" \
  -H "Authorization: Bearer $API_KEY"

Supported Models

The following models are available through this interface (sorted by recommendation):

  • viduq3-pro-img2video New
  • viduq3-turbo-text2video New
  • viduq3-pro-text2video New
  • viduq3-turbo-img2video New
  • viduq3-turbo-img2video-frame New
  • viduq3-pro-img2video-frame New

💡 Tip

The model field in the request example can be replaced with any model name above.

bash
curl -X POST "https://api.agentsflare.com/v1/videos/generations" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "viduq3-turbo-text2video",
    "prompt": "A silver spaceship glides above the sea at sunrise, cinematic light",
    "duration": 5,
    "movement_amplitude": "medium",
    "with_audio": true
  }'
python
import requests
import os

API_BASE = 'https://api.agentsflare.com/v1/videos/generations'
API_KEY = os.getenv('API_KEY')

payload = {
  'model': 'viduq3-turbo-text2video',
  'prompt': 'A silver spaceship glides above the sea at sunrise, cinematic light',
  'duration': 5,
  'movement_amplitude': 'medium',
  'with_audio': True
}

headers = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
resp = requests.post(API_BASE, json=payload, headers=headers)
print(resp.status_code)
print(resp.text)
javascript
const fetch = require('node-fetch');
const API_BASE = 'https://api.agentsflare.com/v1/videos/generations';
const API_KEY = process.env.API_KEY;

const payload = {
  model: 'viduq3-turbo-text2video',
  prompt: 'A silver spaceship glides above the sea at sunrise, cinematic light',
  duration: 5,
  movement_amplitude: 'medium',
  with_audio: true
};

(async () => {
  const res = await fetch(API_BASE, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
    body: JSON.stringify(payload)
  });

  console.log(await res.text());
})();
java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class ViduText2V {
  public static void main(String[] args) throws Exception {
    String apiBase = "https://api.agentsflare.com/v1/videos/generations";
    String apiKey = System.getenv("API_KEY");
    String json = "{\"model\":\"viduq3-turbo-text2video\",\"prompt\":\"A silver spaceship glides above the sea at sunrise, cinematic light\",\"duration\":5,\"movement_amplitude\":\"medium\",\"with_audio\":true}";

    HttpRequest req = HttpRequest.newBuilder()
      .uri(URI.create(apiBase))
      .header("Authorization", "Bearer " + apiKey)
      .header("Content-Type", "application/json")
      .POST(HttpRequest.BodyPublishers.ofString(json))
      .build();

    HttpResponse<String> resp = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
    System.out.println(resp.statusCode());
    System.out.println(resp.body());
  }
}

:::

This documentation is licensed under CC BY-SA 4.0.