플레이그라운드
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 이미지
플레이그라운드
이 페이지에서 실제 Grok Imagine 이미지 작업을 제출한 다음, 반환된 작업 ID로 상태를 폴링합니다.
POST
/
v1
/
task
/
submit
플레이그라운드
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
}
API 키와 prompt를 입력한 다음 전송합니다. 실시간 API가 호출되며, 코드에서 호출하는 것과 동일한
엔드포인트입니다.
완료된 작업에는
이 페이지에서 전송하는 요청은 실제 요청이며 사용자의 키에 과금됩니다.
이미지 1개당 비용은 모델과 등급에 따라 $0.02~$0.08입니다. 이곳의 어떤 기능도
샌드박스나 모의 환경이 아닙니다.
매개변수
string
필수
실행할 모델입니다.
grok-imagine-image, grok-imagine-image-2.0 또는
grok-imagine-image-quality을 허용하며, 정확히 일치해야 합니다 — 별칭은 지원되지 않습니다.object
필수
생성 매개변수입니다. 아래에 나열되지 않은 키는
invalid_params와 함께
거부됩니다.표시 입력
표시 입력
string
필수
생성할 항목입니다. 비워 둘 수 없으며, 최대 32000바이트입니다.
string
기본값:"1k"
1k 또는 2k입니다. 소문자여야 하며 대문자는 거부됩니다.string
기본값:"low"
low 또는 medium입니다. grok-imagine-image-2.0에서만 허용됩니다. 나머지
두 모델에서는 알 수 없는 필드로 반환됩니다.string
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 중 하나입니다. 생략하면 모델 자체의
기본 프레이밍을 사용합니다.integer
기본값:"1"
생성할 이미지 수입니다(1~4). 각 이미지는
outputs의 별도 항목이며,
각각 과금됩니다.string[]
편집하거나 합성할 참조 이미지로, 최대 3개까지 지정할 수 있습니다. 각 항목은
https URL 또는 base64 데이터 URI이며, 각각 약 $0.01이 추가됩니다.string
완료된 작업을 POST할
https URL입니다. 따라서 폴링을 건너뛸 수 있습니다. 반드시
https여야 하며, 그 외의 값은 제출 시점에 거부됩니다.반환 내용
제출하면 1초 이내에 즉시 반환됩니다. 이미지는 이 응답에 포함되지 않습니다. 생성은 백그라운드에서 진행됩니다.| 필드 | 유형 | 참고 사항 |
|---|---|---|
id | string | 작업 id입니다. 이후 모든 작업에 필요합니다. |
status | string | 새 작업에서는 queued입니다. |
created_at | integer | UTC 기준 Unix 초입니다. |
{
"id": "task_2wZ1SuRH4VzXxONqGrH9oCLEZiBQTAVF",
"status": "queued",
"created_at": 1788189088
}
그런 다음 결과를 폴링합니다
이 플레이그라운드는 생성 호출만 다룹니다. 위 응답의id를 가져와
status가 completed 또는 failed에 도달할 때까지 작업을 조회합니다. 약
7~10초가 걸립니다.
curl https://api.widerouter.com/v1/task/$TASK_ID \
-H "Authorization: Bearer $WIDEROUTER_API_KEY"
outputs 배열이 포함됩니다:
{
"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 }
}
출력 URL은 인증이 필요 없으며 작업 완료 후 24시간이 지나면 만료됩니다.
usage.cost_in_usd_ticks는 정가이며, 잔액은 해당 금액에 그룹 배수를 곱한 만큼
변동합니다. 가격을 참조하세요.다음 단계
개요
모든 매개변수, 해상도 및 품질 표, 측정된 지연 시간입니다.
비동기 작업 API
폴링 루프, 콜백 및 전체 오류 표입니다.