VidLab API
One API key for the top image, video and audio models. Each call goes to the best available route at the lowest price, billed from a prepaid balance, and you pay only for generations that succeed.
POST
https://vidlab.ai/v1/generationsQuickstartThe base URL, your key and every endpoint on one page.Submit a generationOne request shape for every model.Get the resultPoll the job and download the file.Price it firstA free quote for the exact request.
Your first request
curl -X POST https://vidlab.ai/v1/generations \
-H "Authorization: Bearer $VIDLAB_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"model": "nano-banana-2",
"input": {
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1
}
}'import os
import uuid
import requests
response = requests.post(
"https://vidlab.ai/v1/generations",
headers={
"Authorization": f"Bearer {os.environ['VIDLAB_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={
"model": "nano-banana-2",
"input": {
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1,
},
},
)
response.raise_for_status()
generation = response.json()["data"]
print(generation["id"], generation["status"])const response = await fetch("https://vidlab.ai/v1/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.VIDLAB_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": crypto.randomUUID(),
},
body: JSON.stringify({
model: "nano-banana-2",
input: {
prompt: "A red sneaker on white",
resolution: "0.5k",
aspect_ratio: "1:1",
n: 1,
},
}),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const { data: generation } = await response.json();
console.dir(generation);package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{
"model": "nano-banana-2",
"input": map[string]any{
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1,
},
})
req, _ := http.NewRequest("POST", "https://vidlab.ai/v1/generations", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("VIDLAB_API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(res.StatusCode, string(out))
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.UUID;
public class Main {
public static void main(String[] args) throws Exception {
String body = """
{
"model": "nano-banana-2",
"input": {
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1
}
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://vidlab.ai/v1/generations"))
.header("Authorization", "Bearer " + System.getenv("VIDLAB_API_KEY"))
.header("Content-Type", "application/json")
.header("Idempotency-Key", UUID.randomUUID().toString())
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode() + " " + response.body());
}
}<?php
$body = [
'model' => 'nano-banana-2',
'input' => [
'prompt' => 'A red sneaker on white',
'resolution' => '0.5k',
'aspect_ratio' => '1:1',
'n' => 1,
],
];
$ch = curl_init('https://vidlab.ai/v1/generations');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('VIDLAB_API_KEY'),
'Content-Type: application/json',
'Idempotency-Key: ' . bin2hex(random_bytes(16)),
],
CURLOPT_POSTFIELDS => json_encode($body),
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;using System.Net.Http.Headers;
using System.Text;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("VIDLAB_API_KEY"));
client.DefaultRequestHeaders.Add("Idempotency-Key", Guid.NewGuid().ToString());
var body = """
{
"model": "nano-banana-2",
"input": {
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1
}
}
""";
var response = await client.PostAsync("https://vidlab.ai/v1/generations",
new StringContent(body, Encoding.UTF8, "application/json"));
Console.WriteLine($"{(int)response.StatusCode} {await response.Content.ReadAsStringAsync()}");{
"model": "nano-banana-2",
"input": {
"prompt": "A red sneaker on white",
"resolution": "0.5k",
"aspect_ratio": "1:1",
"n": 1
}
}