curl --request POST \
--url https://api.varg.ai/v2/tools/{tool_key}/call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "flux_schnell",
"prompt": "a cat astronaut"
}
'import requests
url = "https://api.varg.ai/v2/tools/{tool_key}/call"
payload = {
"model": "flux_schnell",
"prompt": "a cat astronaut"
}
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: 'flux_schnell', prompt: 'a cat astronaut'})
};
fetch('https://api.varg.ai/v2/tools/{tool_key}/call', 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/tools/{tool_key}/call",
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' => 'flux_schnell',
'prompt' => 'a cat astronaut'
]),
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/tools/{tool_key}/call"
payload := strings.NewReader("{\n \"model\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\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/tools/{tool_key}/call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/tools/{tool_key}/call")
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\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\n}"
response = http.request(request)
puts response.read_body{
"id": "job_a1b2c3d4e5f6",
"status": "queued",
"tool": "image",
"input": {},
"output": {
"version": "v1",
"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": "model_not_found",
"message": "Unknown model: flux-shnell"
}
}{
"error": {
"code": "invalid_request",
"message": "Body validation failed (text: Required)"
}
}{
"error": {
"code": "model_not_found",
"message": "Unknown model: flux-shnell",
"details": "<unknown>"
}
}Call a tool generically
Generic equivalent of the sugar routes — POST /tools/image/call is the
same as POST /image. Useful for dynamic clients that discover tools at
runtime via GET /tools.
curl --request POST \
--url https://api.varg.ai/v2/tools/{tool_key}/call \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "flux_schnell",
"prompt": "a cat astronaut"
}
'import requests
url = "https://api.varg.ai/v2/tools/{tool_key}/call"
payload = {
"model": "flux_schnell",
"prompt": "a cat astronaut"
}
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: 'flux_schnell', prompt: 'a cat astronaut'})
};
fetch('https://api.varg.ai/v2/tools/{tool_key}/call', 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/tools/{tool_key}/call",
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' => 'flux_schnell',
'prompt' => 'a cat astronaut'
]),
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/tools/{tool_key}/call"
payload := strings.NewReader("{\n \"model\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\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/tools/{tool_key}/call")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.varg.ai/v2/tools/{tool_key}/call")
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\": \"flux_schnell\",\n \"prompt\": \"a cat astronaut\"\n}"
response = http.request(request)
puts response.read_body{
"id": "job_a1b2c3d4e5f6",
"status": "queued",
"tool": "image",
"input": {},
"output": {
"version": "v1",
"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": "model_not_found",
"message": "Unknown model: flux-shnell"
}
}{
"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).
Path Parameters
Body
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?