curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.",
"size": "1024x1024",
"quality": "high",
"output_format": "png"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "gpt-image-2",
"prompt": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.",
"size": "1024x1024",
"quality": "high",
"output_format": "png"
}
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: 'gpt-image-2',
prompt: 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.',
size: '1024x1024',
quality: 'high',
output_format: 'png'
})
};
fetch('https://api.tikway.ai/v1/images/generations', 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.tikway.ai/v1/images/generations",
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' => 'gpt-image-2',
'prompt' => 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.',
'size' => '1024x1024',
'quality' => 'high',
'output_format' => 'png'
]),
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.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\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.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Image generation
The gateway requires model to be passed in explicitly. Different models only support parameter combinations in the table below.
| Model | Dimensions | Quality | Model-specific parameters |
|---|---|---|---|
gpt-image-2.5-sunburst / flare (including snapshots) | Any WIDTHxHEIGHT (16 multiples, 1:3~3:1, up to 3840x2160) | auto/low/medium/high/xhigh/max | background, moderation, output_format, output_compression, stream, partial_images |
gpt-image-2 (including snapshots) | Same as above | auto/low/medium/high | Same as above; transparent background is still a preview capability |
gpt-image-1 / 1.5 / 1-mini | auto, 1024×1024, 1536×1024, 1024×1536 | auto/low/medium/high | background, moderation, output_format, output_compression, stream, partial_images |
dall-e-3 | 1024×1024, 1792×1024, 1024×1792 | standard/hd | n can only be 1; supports style, response_format |
dall-e-2 | 256×256, 512×512, 1024×1024 | standard | Support n=1..10, response_format |
curl --request POST \
--url https://api.tikway.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2",
"prompt": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.",
"size": "1024x1024",
"quality": "high",
"output_format": "png"
}
'import requests
url = "https://api.tikway.ai/v1/images/generations"
payload = {
"model": "gpt-image-2",
"prompt": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.",
"size": "1024x1024",
"quality": "high",
"output_format": "png"
}
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: 'gpt-image-2',
prompt: 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.',
size: '1024x1024',
quality: 'high',
output_format: 'png'
})
};
fetch('https://api.tikway.ai/v1/images/generations', 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.tikway.ai/v1/images/generations",
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' => 'gpt-image-2',
'prompt' => 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.',
'size' => '1024x1024',
'quality' => 'high',
'output_format' => 'png'
]),
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.tikway.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\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.tikway.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1/images/generations")
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\": \"gpt-image-2\",\n \"prompt\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\",\n \"size\": \"1024x1024\",\n \"quality\": \"high\",\n \"output_format\": \"png\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1713833628,
"data": [
{
"b64_json": "..."
}
],
"usage": {
"total_tokens": 100,
"input_tokens": 50,
"output_tokens": 50,
"input_tokens_details": {
"text_tokens": 10,
"image_tokens": 40
}
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Required. To generate a text description of the image; GPT Image model has a maximum length of 32,000 characters, dall-e-2 has a maximum length of 1,000 characters, and dall-e-3 has a maximum length of 4,000 characters.
1 - 32000Required. Image generation model. The gateway will not adopt OpenAI's dall-e-2 default value, and the model must be passed explicitly.
gpt-image-2.5-sunburst, gpt-image-2.5-sunburst-2026-09-08, gpt-image-2.5-flare, gpt-image-2.5-flare-2026-09-08, gpt-image-2, gpt-image-2-2026-04-21, gpt-image-1.5, gpt-image-1, gpt-image-1-mini, dall-e-2, dall-e-3 Background settings, only supported by GPT Image model. When using transparent output_format must be png or webp.
transparent, opaque, auto, null Content moderation level, only supported by the GPT Image model. auto is the default value.
low, auto, null The number of images generated. dall-e-3 only supports 1.
1 <= x <= 10Image compression ratio (0–100), only supported by webp or jpeg output of GPT Image, default 100.
0 <= x <= 100Output image format, only supported by GPT Image model.
png, jpeg, webp, null The number of intermediate images returned in the streaming response, only supported by the GPT Image model.
0 <= x <= 3Image quality. GPT Image supports auto/low/medium/high; GPT Image 2.5 additionally supports xhigh/max; dall-e-3 supports standard/hd; dall-e-2 only supports standard.
auto, low, medium, high, xhigh, max, standard, hd, null Only dall-e-2 and dall-e-3 support url or b64_json. The GPT Image model always returns Base64 and this upstream parameter is not supported.
b64_json, url Image size. GPT Image 2/2.5 supports WIDTHxHEIGHT: width and height are multiples of 16, ratio 1:3~3:1, up to 3840x2160; other GPT Images use auto, 1024x1024, 1536x1024 or 1024x1536; supported by dall-e-2 256x256, 512x512, 1024x1024; dall-e-3 supports 1024x1024, 1792x1024, 1024x1792.
auto, 256x256, 512x512, 1024x1024, 1536x1024, 1024x1536, 1792x1024, 1024x1792, null Whether to use SSE streaming generation, only supported by GPT Image model, default false.
Generate style, only supported by dall-e-3.
vivid, natural, null The unique identifier of the end user, used for abuse monitoring and detection.
Response
Unix timestamp in seconds when the image was created.
Generate a list of results.
Hide child attributes
Hide child attributes
Base64 encoded image data. GPT Image is returned by default; DALL·E is returned when response_format=b64_json.
DALL·E 3 Revision prompt words actually used.
Generate image URL. Returned only when DALL·E and response_format=url; valid for 60 minutes.
The actual background settings used.
transparent, opaque Actual output image format.
png, webp, jpeg Actual build quality.
low, medium, high The actual resulting image size.
The token usage of the GPT Image model.
Hide child attributes
Hide child attributes
Number of tokens for input (text and image).
Output the number of tokens.
The total number of input and output tokens.

