Playground
curl --request POST \
--url https://api.widerouter.com/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"input.prompt": "<string>",
"input.resolution": "<string>",
"input.quality": "<string>",
"input.aspect_ratio": "<string>",
"input.n": 123,
"input.images": [
"<string>"
]
},
"callback_url": "<string>"
}
'import requests
url = "https://api.widerouter.com/v1/task/submit"
payload = {
"model": "<string>",
"input": {
"input.prompt": "<string>",
"input.resolution": "<string>",
"input.quality": "<string>",
"input.aspect_ratio": "<string>",
"input.n": 123,
"input.images": ["<string>"]
},
"callback_url": "<string>"
}
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: '<string>',
input: {
'input.prompt': '<string>',
'input.resolution': '<string>',
'input.quality': '<string>',
'input.aspect_ratio': '<string>',
'input.n': 123,
'input.images': ['<string>']
},
callback_url: '<string>'
})
};
fetch('https://api.widerouter.com/v1/task/submit', 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.widerouter.com/v1/task/submit",
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' => '<string>',
'input' => [
'input.prompt' => '<string>',
'input.resolution' => '<string>',
'input.quality' => '<string>',
'input.aspect_ratio' => '<string>',
'input.n' => 123,
'input.images' => [
'<string>'
]
],
'callback_url' => '<string>'
]),
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.widerouter.com/v1/task/submit"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\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.widerouter.com/v1/task/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.widerouter.com/v1/task/submit")
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\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
"status": "queued",
"created_at": 1788189088
}
Grok Imagine image
Playground
Submit a real Grok Imagine image task from this page, then poll it with the returned task id.
POST
/
v1
/
task
/
submit
Playground
curl --request POST \
--url https://api.widerouter.com/v1/task/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {
"input.prompt": "<string>",
"input.resolution": "<string>",
"input.quality": "<string>",
"input.aspect_ratio": "<string>",
"input.n": 123,
"input.images": [
"<string>"
]
},
"callback_url": "<string>"
}
'import requests
url = "https://api.widerouter.com/v1/task/submit"
payload = {
"model": "<string>",
"input": {
"input.prompt": "<string>",
"input.resolution": "<string>",
"input.quality": "<string>",
"input.aspect_ratio": "<string>",
"input.n": 123,
"input.images": ["<string>"]
},
"callback_url": "<string>"
}
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: '<string>',
input: {
'input.prompt': '<string>',
'input.resolution': '<string>',
'input.quality': '<string>',
'input.aspect_ratio': '<string>',
'input.n': 123,
'input.images': ['<string>']
},
callback_url: '<string>'
})
};
fetch('https://api.widerouter.com/v1/task/submit', 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.widerouter.com/v1/task/submit",
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' => '<string>',
'input' => [
'input.prompt' => '<string>',
'input.resolution' => '<string>',
'input.quality' => '<string>',
'input.aspect_ratio' => '<string>',
'input.n' => 123,
'input.images' => [
'<string>'
]
],
'callback_url' => '<string>'
]),
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.widerouter.com/v1/task/submit"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\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.widerouter.com/v1/task/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.widerouter.com/v1/task/submit")
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\": \"<string>\",\n \"input\": {\n \"input.prompt\": \"<string>\",\n \"input.resolution\": \"<string>\",\n \"input.quality\": \"<string>\",\n \"input.aspect_ratio\": \"<string>\",\n \"input.n\": 123,\n \"input.images\": [\n \"<string>\"\n ]\n },\n \"callback_url\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
"status": "queued",
"created_at": 1788189088
}
Fill in your API key and a prompt, then send. This hits the live API — the same
endpoint your code would call.
A finished task carries an
Requests sent from this page are real and are billed to your key.
A single image costs $0.02 to $0.08 depending on the model and tier. Nothing
here is a sandbox or a mock.
Parameters
string
required
Which model to run. Accepts
grok-imagine-image, grok-imagine-image-2.0 or
grok-imagine-image-quality, matched exactly — no aliases.object
required
The generation parameters. Any key not listed below is rejected with
invalid_params.Show input
Show input
string
required
What to generate. Must not be empty; at most 32000 bytes.
string
default:"1k"
1k or 2k. Lowercase — uppercase is rejected.string
default:"low"
low or medium. Only accepted by grok-imagine-image-2.0; on the
other two models it comes back as an unknown field.string
One of
auto 1:1 16:9 9:16 4:3 3:4 3:2 2:3 2:1 1:2
19.5:9 9:19.5 20:9 9:20 21:9 5:2. Omit it to use the model’s
own default framing.integer
default:"1"
How many images to produce, 1 to 4. Each one is a separate entry in
outputs, and each one is billed.string[]
Reference images to edit or compose from, up to 3. Each entry is an
https URL or a base64 data URI, and each adds about $0.01.string
An
https URL to POST the finished task to, so you can skip polling. Must be
https — anything else is rejected at submit time.What comes back
Submitting returns immediately, in well under a second. The image is not in this response — generation happens in the background.| Field | Type | Notes |
|---|---|---|
id | string | The task id. Everything else needs it. |
status | string | queued on a fresh task. |
created_at | integer | Unix seconds, UTC. |
{
"id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
"status": "queued",
"created_at": 1788189088
}
Then poll for the result
This playground covers the create call only. Take theid from the response
above and read the task until status reaches completed or failed — expect
about 7 to 10 seconds.
curl https://api.widerouter.com/v1/task/$TASK_ID \
-H "Authorization: Bearer $WIDEROUTER_API_KEY"
outputs array:
{
"id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
"model": "grok-imagine-image",
"status": "completed",
"created_at": 1788189088,
"completed_at": 1788189094,
"expires_at": 1788275494,
"outputs": ["https://r2cdn.agisuitepro.com/o/2026/08/31/task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF_0.jpg"],
"counts": { "requested": 1, "succeeded": 1, "failed": 0 },
"usage": { "cost_in_usd_ticks": 200000000 }
}
Output URLs are unauthenticated and expire 24 hours after the task finishes.
usage.cost_in_usd_ticks is the list price; your balance moves by that
figure times your group multiplier — see
pricing.Next steps
Overview
Every parameter, the resolution and quality grid, and measured latency.
Async task API
The polling loop, callbacks and the full error table.