# Kling O3 Omni API

Unified multimodal video reasoning, subject consistency and motion control · 720p to 1080p

| | |
| - | - |
| Model id | `kling-o3` |
| Maker | Kuaishou |
| Kind | Video |
| Endpoint | `POST https://vidlab.ai/v1/generations` |
| Billed | per second of output, only when it succeeds |

## Pricing

| Option | Price |
| - | - |
| `720p` | $0.09 |
| `1080p` | $0.15 |
| `4k` | $0.42 |

## Text to video

| Field | Type | Required | Default | Allowed |
| - | - | - | - | - |
| `model` | string | Yes |  | Must be kling-o3 |
| `input` | object | Yes |  | The fields below. |
| `max_cost_usd` | number | No |  | Dollars. The most you will pay. Over it, the call answers 422 and nothing is held. |
| `max_wait_s` | number | No |  | Seconds. The longest you will wait. |
| `input.prompt` | string | Yes |  | Up to 20,000 characters. What to make. |
| `input.resolution` | string | No | 720p | One of: 720p, 1080p, 4k. Output resolution. |
| `input.aspect_ratio` | string | No | 16:9 | One of: 16:9, 9:16, 1:1. Shape of the output. |
| `input.duration` | number | No | 3 | 3 to 15 seconds. Seconds of output. |
| `input.negative_prompt` | string | No |  | Up to 5,000 characters. What to avoid. |
| `input.seed` | integer | No |  | A whole number. Repeatable results where the model supports it. |

```bash cURL
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": "kling-o3",
  "input": {
    "prompt": "A slow push-in on a perfume bottle on wet black stone",
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5
  }
}'
```

```python Python
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": "kling-o3",
        "input": {
            "prompt": "A slow push-in on a perfume bottle on wet black stone",
            "resolution": "720p",
            "aspect_ratio": "16:9",
            "duration": 5,
        },
    },
)
response.raise_for_status()
generation = response.json()["data"]
print(generation["id"], generation["status"])
```

```javascript JavaScript
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: "kling-o3",
    input: {
      prompt: "A slow push-in on a perfume bottle on wet black stone",
      resolution: "720p",
      aspect_ratio: "16:9",
      duration: 5,
    },
  }),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const { data: generation } = await response.json();
console.dir(generation);
```

```go Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"model": "kling-o3",
		"input": map[string]any{
			"prompt": "A slow push-in on a perfume bottle on wet black stone",
			"resolution": "720p",
			"aspect_ratio": "16:9",
			"duration": 5,
		},
	})

	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))
}
```

```java Java
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": "kling-o3",
              "input": {
                "prompt": "A slow push-in on a perfume bottle on wet black stone",
                "resolution": "720p",
                "aspect_ratio": "16:9",
                "duration": 5
              }
            }
            """;

        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 PHP
<?php
$body = [
    'model' => 'kling-o3',
    'input' => [
        'prompt' => 'A slow push-in on a perfume bottle on wet black stone',
        'resolution' => '720p',
        'aspect_ratio' => '16:9',
        'duration' => 5,
    ],
];

$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;
```

```csharp C#
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": "kling-o3",
      "input": {
        "prompt": "A slow push-in on a perfume bottle on wet black stone",
        "resolution": "720p",
        "aspect_ratio": "16:9",
        "duration": 5
      }
    }
    """;

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()}");
```

```json JSON
{
  "model": "kling-o3",
  "input": {
    "prompt": "A slow push-in on a perfume bottle on wet black stone",
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5
  }
}
```

Response (202):

```json
{
  "data": {
    "id": "gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "object": "generation",
    "status": "queued",
    "model": "kling-o3",
    "variant": "720p",
    "units": 5,
    "price_usd": 0.45,
    "outputs": [],
    "created_at": "2026-11-01T18:04:11.000Z",
    "status_url": "/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "result_url": "/v1/jobs/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c/result"
  }
}
```

## Image to video

| Field | Type | Required | Default | Allowed |
| - | - | - | - | - |
| `model` | string | Yes |  | Must be kling-o3 |
| `input` | object | Yes |  | The fields below. |
| `max_cost_usd` | number | No |  | Dollars. The most you will pay. Over it, the call answers 422 and nothing is held. |
| `max_wait_s` | number | No |  | Seconds. The longest you will wait. |
| `input.prompt` | string | Yes |  | Up to 20,000 characters. What to make. |
| `input.resolution` | string | No | 720p | One of: 720p, 1080p, 4k. Output resolution. |
| `input.aspect_ratio` | string | No | Follows your input | One of: 16:9, 9:16, 1:1. Shape of the output. |
| `input.duration` | number | No | 3 | 3 to 15 seconds. Seconds of output. |
| `input.images` | array of files | Yes |  | 1 file. Reference images. A first frame or main reference goes first. |
| `input.negative_prompt` | string | No |  | Up to 5,000 characters. What to avoid. |
| `input.seed` | integer | No |  | A whole number. Repeatable results where the model supports it. |

```bash cURL
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": "kling-o3",
  "input": {
    "prompt": "She smiles and lifts the cup",
    "resolution": "720p",
    "duration": 5,
    "images": [
      "https://example.com/start.jpg"
    ]
  }
}'
```

```python Python
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": "kling-o3",
        "input": {
            "prompt": "She smiles and lifts the cup",
            "resolution": "720p",
            "duration": 5,
            "images": [
                "https://example.com/start.jpg",
            ],
        },
    },
)
response.raise_for_status()
generation = response.json()["data"]
print(generation["id"], generation["status"])
```

```javascript JavaScript
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: "kling-o3",
    input: {
      prompt: "She smiles and lifts the cup",
      resolution: "720p",
      duration: 5,
      images: [
        "https://example.com/start.jpg",
      ],
    },
  }),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const { data: generation } = await response.json();
console.dir(generation);
```

```go Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"model": "kling-o3",
		"input": map[string]any{
			"prompt": "She smiles and lifts the cup",
			"resolution": "720p",
			"duration": 5,
			"images": []any{
				"https://example.com/start.jpg",
			},
		},
	})

	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))
}
```

```java Java
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": "kling-o3",
              "input": {
                "prompt": "She smiles and lifts the cup",
                "resolution": "720p",
                "duration": 5,
                "images": [
                  "https://example.com/start.jpg"
                ]
              }
            }
            """;

        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 PHP
<?php
$body = [
    'model' => 'kling-o3',
    'input' => [
        'prompt' => 'She smiles and lifts the cup',
        'resolution' => '720p',
        'duration' => 5,
        'images' => [
            'https://example.com/start.jpg',
        ],
    ],
];

$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;
```

```csharp C#
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": "kling-o3",
      "input": {
        "prompt": "She smiles and lifts the cup",
        "resolution": "720p",
        "duration": 5,
        "images": [
          "https://example.com/start.jpg"
        ]
      }
    }
    """;

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()}");
```

```json JSON
{
  "model": "kling-o3",
  "input": {
    "prompt": "She smiles and lifts the cup",
    "resolution": "720p",
    "duration": 5,
    "images": [
      "https://example.com/start.jpg"
    ]
  }
}
```

Response (202):

```json
{
  "data": {
    "id": "gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "object": "generation",
    "status": "queued",
    "model": "kling-o3",
    "variant": "720p",
    "units": 5,
    "price_usd": 0.45,
    "outputs": [],
    "created_at": "2026-11-01T18:04:11.000Z",
    "status_url": "/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "result_url": "/v1/jobs/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c/result"
  }
}
```

## Reference to video

| Field | Type | Required | Default | Allowed |
| - | - | - | - | - |
| `model` | string | Yes |  | Must be kling-o3 |
| `input` | object | Yes |  | The fields below. |
| `max_cost_usd` | number | No |  | Dollars. The most you will pay. Over it, the call answers 422 and nothing is held. |
| `max_wait_s` | number | No |  | Seconds. The longest you will wait. |
| `input.prompt` | string | Yes |  | Up to 20,000 characters. What to make. |
| `input.resolution` | string | No | 720p | One of: 720p, 1080p, 4k. Output resolution. |
| `input.aspect_ratio` | string | No | Follows your input | One of: 16:9, 9:16, 1:1. Shape of the output. |
| `input.duration` | number | No | 3 | 3 to 15 seconds. Seconds of output. |
| `input.images` | array of files | One of |  | 1 file. Reference images. A first frame or main reference goes first. |
| `input.video` | file | One of |  | 1 file. A reference or source clip. |
| `input.negative_prompt` | string | No |  | Up to 5,000 characters. What to avoid. |
| `input.seed` | integer | No |  | A whole number. Repeatable results where the model supports it. |

```bash cURL
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": "kling-o3",
  "input": {
    "prompt": "A slow push-in on the product from the references",
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5,
    "images": [
      "https://example.com/reference-1.jpg"
    ]
  }
}'
```

```python Python
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": "kling-o3",
        "input": {
            "prompt": "A slow push-in on the product from the references",
            "resolution": "720p",
            "aspect_ratio": "16:9",
            "duration": 5,
            "images": [
                "https://example.com/reference-1.jpg",
            ],
        },
    },
)
response.raise_for_status()
generation = response.json()["data"]
print(generation["id"], generation["status"])
```

```javascript JavaScript
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: "kling-o3",
    input: {
      prompt: "A slow push-in on the product from the references",
      resolution: "720p",
      aspect_ratio: "16:9",
      duration: 5,
      images: [
        "https://example.com/reference-1.jpg",
      ],
    },
  }),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const { data: generation } = await response.json();
console.dir(generation);
```

```go Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"model": "kling-o3",
		"input": map[string]any{
			"prompt": "A slow push-in on the product from the references",
			"resolution": "720p",
			"aspect_ratio": "16:9",
			"duration": 5,
			"images": []any{
				"https://example.com/reference-1.jpg",
			},
		},
	})

	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))
}
```

```java Java
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": "kling-o3",
              "input": {
                "prompt": "A slow push-in on the product from the references",
                "resolution": "720p",
                "aspect_ratio": "16:9",
                "duration": 5,
                "images": [
                  "https://example.com/reference-1.jpg"
                ]
              }
            }
            """;

        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 PHP
<?php
$body = [
    'model' => 'kling-o3',
    'input' => [
        'prompt' => 'A slow push-in on the product from the references',
        'resolution' => '720p',
        'aspect_ratio' => '16:9',
        'duration' => 5,
        'images' => [
            'https://example.com/reference-1.jpg',
        ],
    ],
];

$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;
```

```csharp C#
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": "kling-o3",
      "input": {
        "prompt": "A slow push-in on the product from the references",
        "resolution": "720p",
        "aspect_ratio": "16:9",
        "duration": 5,
        "images": [
          "https://example.com/reference-1.jpg"
        ]
      }
    }
    """;

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()}");
```

```json JSON
{
  "model": "kling-o3",
  "input": {
    "prompt": "A slow push-in on the product from the references",
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "duration": 5,
    "images": [
      "https://example.com/reference-1.jpg"
    ]
  }
}
```

Response (202):

```json
{
  "data": {
    "id": "gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "object": "generation",
    "status": "queued",
    "model": "kling-o3",
    "variant": "720p",
    "units": 5,
    "price_usd": 0.45,
    "outputs": [],
    "created_at": "2026-11-01T18:04:11.000Z",
    "status_url": "/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "result_url": "/v1/jobs/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c/result"
  }
}
```

## Edit video

| Field | Type | Required | Default | Allowed |
| - | - | - | - | - |
| `model` | string | Yes |  | Must be kling-o3 |
| `input` | object | Yes |  | The fields below. |
| `max_cost_usd` | number | No |  | Dollars. The most you will pay. Over it, the call answers 422 and nothing is held. |
| `max_wait_s` | number | No |  | Seconds. The longest you will wait. |
| `input.prompt` | string | Yes |  | Up to 20,000 characters. What to make. |
| `input.resolution` | string | No | 720p | One of: 720p, 1080p, 4k. Output resolution. |
| `input.duration` | number | No | 3 | 3 to 15 seconds. Seconds of output. |
| `input.video` | file | Yes |  | 1 file. A reference or source clip. |
| `input.negative_prompt` | string | No |  | Up to 5,000 characters. What to avoid. |
| `input.seed` | integer | No |  | A whole number. Repeatable results where the model supports it. |

```bash cURL
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": "kling-o3",
  "input": {
    "prompt": "Make the car red",
    "resolution": "720p",
    "duration": 5,
    "video": "https://example.com/clip.mp4"
  }
}'
```

```python Python
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": "kling-o3",
        "input": {
            "prompt": "Make the car red",
            "resolution": "720p",
            "duration": 5,
            "video": "https://example.com/clip.mp4",
        },
    },
)
response.raise_for_status()
generation = response.json()["data"]
print(generation["id"], generation["status"])
```

```javascript JavaScript
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: "kling-o3",
    input: {
      prompt: "Make the car red",
      resolution: "720p",
      duration: 5,
      video: "https://example.com/clip.mp4",
    },
  }),
});
if (!response.ok) throw new Error((await response.json()).error.message);
const { data: generation } = await response.json();
console.dir(generation);
```

```go Go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body, _ := json.Marshal(map[string]any{
		"model": "kling-o3",
		"input": map[string]any{
			"prompt": "Make the car red",
			"resolution": "720p",
			"duration": 5,
			"video": "https://example.com/clip.mp4",
		},
	})

	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))
}
```

```java Java
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": "kling-o3",
              "input": {
                "prompt": "Make the car red",
                "resolution": "720p",
                "duration": 5,
                "video": "https://example.com/clip.mp4"
              }
            }
            """;

        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 PHP
<?php
$body = [
    'model' => 'kling-o3',
    'input' => [
        'prompt' => 'Make the car red',
        'resolution' => '720p',
        'duration' => 5,
        'video' => 'https://example.com/clip.mp4',
    ],
];

$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;
```

```csharp C#
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": "kling-o3",
      "input": {
        "prompt": "Make the car red",
        "resolution": "720p",
        "duration": 5,
        "video": "https://example.com/clip.mp4"
      }
    }
    """;

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()}");
```

```json JSON
{
  "model": "kling-o3",
  "input": {
    "prompt": "Make the car red",
    "resolution": "720p",
    "duration": 5,
    "video": "https://example.com/clip.mp4"
  }
}
```

Response (202):

```json
{
  "data": {
    "id": "gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "object": "generation",
    "status": "queued",
    "model": "kling-o3",
    "variant": "720p",
    "units": 5,
    "price_usd": 0.45,
    "outputs": [],
    "created_at": "2026-11-01T18:04:11.000Z",
    "status_url": "/v1/generations/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c",
    "result_url": "/v1/jobs/gen_4Fq9xT2mLr7Kd1sV8bN3pZ0c/result"
  }
}
```

## Errors

| Status | Code | When |
| - | - | - |
| 400 | `invalid_input` | A field this model does not take, a value that is not allowed, or a required field left out. The message names it. |
| 401 | `unauthorized` | The key is missing, unknown or revoked. |
| 422 | `max_cost_exceeded` | No route can run the call for max_cost_usd or less. Nothing is held. |
| 429 | `api_wallet_exhausted` | The balance has no room for this price. Add credit. |
| 429 | `request_per_minute` | This key started too many generations this minute. Wait for Retry-After. |
| 503 | `model_unavailable` | The model is busy right now. Retry after Retry-After. |

Poll `GET https://vidlab.ai/v1/generations/{id}` until `status` is `succeeded` or `failed`. Docs: https://docs.vidlab.ai/get-the-result.md
