curl --request POST \
--url https://api.varg.ai/v2/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "import { Render, Clip, Image, Video } from \"vargai/react\";\nimport { fal } from \"vargai/ai\";\nconst img = Image({ prompt: \"cute orange cat, Pixar style\", aspectRatio: \"9:16\", model: fal.imageModel(\"nano_banana_pro\") });\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \"cat waves hello\", images: [img] }} model={fal.videoModel(\"kling_v3\")} /></Clip></Render>;",
"mode": "strict",
"output": "video"
}
'import requests
url = "https://api.varg.ai/v2/render"
payload = {
"code": "import { Render, Clip, Image, Video } from \"vargai/react\";
import { fal } from \"vargai/ai\";
const img = Image({ prompt: \"cute orange cat, Pixar style\", aspectRatio: \"9:16\", model: fal.imageModel(\"nano_banana_pro\") });
export default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \"cat waves hello\", images: [img] }} model={fal.videoModel(\"kling_v3\")} /></Clip></Render>;",
"mode": "strict",
"output": "video"
}
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({
code: 'import { Render, Clip, Image, Video } from "vargai/react";\nimport { fal } from "vargai/ai";\nconst img = Image({ prompt: "cute orange cat, Pixar style", aspectRatio: "9:16", model: fal.imageModel("nano_banana_pro") });\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: "cat waves hello", images: [img] }} model={fal.videoModel("kling_v3")} /></Clip></Render>;',
mode: 'strict',
output: 'video'
})
};
fetch('https://api.varg.ai/v2/render', 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.varg.ai/v2/render",
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([
'code' => 'import { Render, Clip, Image, Video } from "vargai/react";
import { fal } from "vargai/ai";
const img = Image({ prompt: "cute orange cat, Pixar style", aspectRatio: "9:16", model: fal.imageModel("nano_banana_pro") });
export default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: "cat waves hello", images: [img] }} model={fal.videoModel("kling_v3")} /></Clip></Render>;',
'mode' => 'strict',
'output' => 'video'
]),
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.varg.ai/v2/render"
payload := strings.NewReader("{\n \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\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.varg.ai/v2/render")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/render")
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 \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\n}"
response = http.request(request)
puts response.read_body{
"id": "job_a1b2c3d4e5f6",
"tool": "image",
"input": {},
"output": {
"version": "<string>",
"outputs": [
{
"url": "<string>",
"file_id": "<string>",
"media_type": "video/mp4",
"size_bytes": 123,
"thumbnail_url": "<string>"
}
]
},
"error": {},
"progress_message": "stitching 3/8 (40%)",
"progress": 123,
"progress_metadata": {},
"estimated_duration_ms": 123,
"estimated_cost_cents": 123,
"actual_cost_cents": 123,
"pricing": {
"estimated": 123,
"actual": 123,
"billing": "<string>",
"cached": true,
"billed_units": {
"images": 1
},
"pricing_id": "<string>"
},
"provider": "fal",
"provider_model": "fal:flux_schnell",
"provider_status": "<string>",
"provider_job_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"urls": {
"self": "<string>",
"status": "<string>",
"refresh": "<string>",
"cancel": "<string>",
"retry": "<string>"
}
}{
"id": "job_a1b2c3d4e5f6",
"status": "queued",
"tool": "image",
"input": {
"model": "flux_schnell",
"prompt": "a cat astronaut"
},
"output": null,
"error": null,
"estimated_cost_cents": 4,
"actual_cost_cents": null,
"pricing": {
"estimated": 4,
"actual": null,
"billing": "metered",
"cached": null,
"billed_units": null,
"pricing_id": "ppr_abc123"
},
"provider": "fal",
"provider_model": "fal:flux_schnell",
"created_at": "2026-07-01T10:00:00Z",
"urls": {
"self": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6",
"status": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/status",
"refresh": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/refresh",
"cancel": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/cancel",
"retry": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/retry"
}
}{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance to run this job"
}
}{
"error": {
"code": "invalid_request",
"message": "Body validation failed (text: Required)"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Render TSX to video
Submit varg TSX code and get back a rendered video (or image frames). No local setup needed — the render runs in the cloud, generating AI assets and stitching them together.
Billing: a flat stitching fee (~5 credits) plus each AI sub-generation billed as its own job. Sub-generation assets are linked to the render job, so partial work is recoverable even if the render fails.
curl --request POST \
--url https://api.varg.ai/v2/render \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "import { Render, Clip, Image, Video } from \"vargai/react\";\nimport { fal } from \"vargai/ai\";\nconst img = Image({ prompt: \"cute orange cat, Pixar style\", aspectRatio: \"9:16\", model: fal.imageModel(\"nano_banana_pro\") });\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \"cat waves hello\", images: [img] }} model={fal.videoModel(\"kling_v3\")} /></Clip></Render>;",
"mode": "strict",
"output": "video"
}
'import requests
url = "https://api.varg.ai/v2/render"
payload = {
"code": "import { Render, Clip, Image, Video } from \"vargai/react\";
import { fal } from \"vargai/ai\";
const img = Image({ prompt: \"cute orange cat, Pixar style\", aspectRatio: \"9:16\", model: fal.imageModel(\"nano_banana_pro\") });
export default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \"cat waves hello\", images: [img] }} model={fal.videoModel(\"kling_v3\")} /></Clip></Render>;",
"mode": "strict",
"output": "video"
}
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({
code: 'import { Render, Clip, Image, Video } from "vargai/react";\nimport { fal } from "vargai/ai";\nconst img = Image({ prompt: "cute orange cat, Pixar style", aspectRatio: "9:16", model: fal.imageModel("nano_banana_pro") });\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: "cat waves hello", images: [img] }} model={fal.videoModel("kling_v3")} /></Clip></Render>;',
mode: 'strict',
output: 'video'
})
};
fetch('https://api.varg.ai/v2/render', 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.varg.ai/v2/render",
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([
'code' => 'import { Render, Clip, Image, Video } from "vargai/react";
import { fal } from "vargai/ai";
const img = Image({ prompt: "cute orange cat, Pixar style", aspectRatio: "9:16", model: fal.imageModel("nano_banana_pro") });
export default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: "cat waves hello", images: [img] }} model={fal.videoModel("kling_v3")} /></Clip></Render>;',
'mode' => 'strict',
'output' => 'video'
]),
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.varg.ai/v2/render"
payload := strings.NewReader("{\n \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\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.varg.ai/v2/render")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/render")
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 \"code\": \"import { Render, Clip, Image, Video } from \\\"vargai/react\\\";\\nimport { fal } from \\\"vargai/ai\\\";\\nconst img = Image({ prompt: \\\"cute orange cat, Pixar style\\\", aspectRatio: \\\"9:16\\\", model: fal.imageModel(\\\"nano_banana_pro\\\") });\\nexport default <Render width={1080} height={1920}><Clip duration={3}><Video prompt={{ text: \\\"cat waves hello\\\", images: [img] }} model={fal.videoModel(\\\"kling_v3\\\")} /></Clip></Render>;\",\n \"mode\": \"strict\",\n \"output\": \"video\"\n}"
response = http.request(request)
puts response.read_body{
"id": "job_a1b2c3d4e5f6",
"tool": "image",
"input": {},
"output": {
"version": "<string>",
"outputs": [
{
"url": "<string>",
"file_id": "<string>",
"media_type": "video/mp4",
"size_bytes": 123,
"thumbnail_url": "<string>"
}
]
},
"error": {},
"progress_message": "stitching 3/8 (40%)",
"progress": 123,
"progress_metadata": {},
"estimated_duration_ms": 123,
"estimated_cost_cents": 123,
"actual_cost_cents": 123,
"pricing": {
"estimated": 123,
"actual": 123,
"billing": "<string>",
"cached": true,
"billed_units": {
"images": 1
},
"pricing_id": "<string>"
},
"provider": "fal",
"provider_model": "fal:flux_schnell",
"provider_status": "<string>",
"provider_job_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"urls": {
"self": "<string>",
"status": "<string>",
"refresh": "<string>",
"cancel": "<string>",
"retry": "<string>"
}
}{
"id": "job_a1b2c3d4e5f6",
"status": "queued",
"tool": "image",
"input": {
"model": "flux_schnell",
"prompt": "a cat astronaut"
},
"output": null,
"error": null,
"estimated_cost_cents": 4,
"actual_cost_cents": null,
"pricing": {
"estimated": 4,
"actual": null,
"billing": "metered",
"cached": null,
"billed_units": null,
"pricing_id": "ppr_abc123"
},
"provider": "fal",
"provider_model": "fal:flux_schnell",
"created_at": "2026-07-01T10:00:00Z",
"urls": {
"self": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6",
"status": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/status",
"refresh": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/refresh",
"cancel": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/cancel",
"retry": "https://api.varg.ai/v2/jobs/job_a1b2c3d4e5f6/retry"
}
}{
"error": {
"code": "insufficient_balance",
"message": "Insufficient balance to run this job"
}
}{
"error": {
"code": "invalid_request",
"message": "Body validation failed (text: Required)"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Authorizations
varg API key (varg_...). Get one at app.varg.ai
or run bunx vargai login. App sessions may alternatively send a
Supabase JWT.
Headers
Any unique string. Retrying a request with the same key returns the existing job (HTTP 200) instead of creating and charging a new one (HTTP 202).
Body
TSX source. Import components from vargai/react and providers
from vargai/ai, and default-export a <Render> element.
strict (default) fails on errors; preview substitutes placeholders
strict, preview frames skips stitching for image-only renders
video, frames Response
Idempotency replay — the existing job for this Idempotency-Key (no new charge).
"job_a1b2c3d4e5f6"
Lifecycle is queued then submitting then running, ending in a
terminal status (completed, failed, or cancelled).
queued, submitting, running, completed, failed, cancelled "image"
The request body as submitted (model, prompt, ...)
Canonical output envelope. Present only when the job is completed.
Show child attributes
Show child attributes
"stitching 3/8 (40%)"
Fraction 0..1
Structured pricing. 1 credit = 1 cent = $0.01.
Show child attributes
Show child attributes
"fal"
"fal:flux_schnell"
The provider's raw status string
Lifecycle URLs (present on creation responses)
Show child attributes
Show child attributes
Was this page helpful?