curl --request POST \
--url https://api.tikway.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field."
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
],
"responseFormat": {
"image": {
"aspectRatio": "1:1",
"imageSize": "1K"
}
}
}
}
'import requests
url = "https://api.tikway.ai/v1beta/models/{model}:generateContent"
payload = {
"contents": [
{
"role": "user",
"parts": [{ "text": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field." }]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"],
"responseFormat": { "image": {
"aspectRatio": "1:1",
"imageSize": "1K"
} }
}
}
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({
contents: [
{
role: 'user',
parts: [
{
text: 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.'
}
]
}
],
generationConfig: {
responseModalities: ['IMAGE'],
responseFormat: {image: {aspectRatio: '1:1', imageSize: '1K'}}
}
})
};
fetch('https://api.tikway.ai/v1beta/models/{model}:generateContent', 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/v1beta/models/{model}:generateContent",
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([
'contents' => [
[
'role' => 'user',
'parts' => [
[
'text' => 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.'
]
]
]
],
'generationConfig' => [
'responseModalities' => [
'IMAGE'
],
'responseFormat' => [
'image' => [
'aspectRatio' => '1:1',
'imageSize' => '1K'
]
]
]
]),
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/v1beta/models/{model}:generateContent"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\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/v1beta/models/{model}:generateContent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1beta/models/{model}:generateContent")
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 \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"candidates": [
{
"content": {
"parts": [
{
"inlineData": {
"mimeType": "image/png",
"data": "<Base64 string of generated image>"
}
}
]
},
"finishReason": "STOP"
}
]
}Gemini protocol - image generation
Gemini native entrance. gemini-2.5-flash-image only supports aspectRatio; the Gemini 3 image model also supports imageSize. Reference diagrams and search/think ability limits are consistent with the Unified Portal’s model sheet.
curl --request POST \
--url https://api.tikway.ai/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field."
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
],
"responseFormat": {
"image": {
"aspectRatio": "1:1",
"imageSize": "1K"
}
}
}
}
'import requests
url = "https://api.tikway.ai/v1beta/models/{model}:generateContent"
payload = {
"contents": [
{
"role": "user",
"parts": [{ "text": "Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field." }]
}
],
"generationConfig": {
"responseModalities": ["IMAGE"],
"responseFormat": { "image": {
"aspectRatio": "1:1",
"imageSize": "1K"
} }
}
}
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({
contents: [
{
role: 'user',
parts: [
{
text: 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.'
}
]
}
],
generationConfig: {
responseModalities: ['IMAGE'],
responseFormat: {image: {aspectRatio: '1:1', imageSize: '1K'}}
}
})
};
fetch('https://api.tikway.ai/v1beta/models/{model}:generateContent', 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/v1beta/models/{model}:generateContent",
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([
'contents' => [
[
'role' => 'user',
'parts' => [
[
'text' => 'Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.'
]
]
]
],
'generationConfig' => [
'responseModalities' => [
'IMAGE'
],
'responseFormat' => [
'image' => [
'aspectRatio' => '1:1',
'imageSize' => '1K'
]
]
]
]),
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/v1beta/models/{model}:generateContent"
payload := strings.NewReader("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\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/v1beta/models/{model}:generateContent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tikway.ai/v1beta/models/{model}:generateContent")
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 \"contents\": [\n {\n \"role\": \"user\",\n \"parts\": [\n {\n \"text\": \"Generate a photorealistic red apple resting on a rustic wooden table, soft window light, shallow depth of field.\"\n }\n ]\n }\n ],\n \"generationConfig\": {\n \"responseModalities\": [\n \"IMAGE\"\n ],\n \"responseFormat\": {\n \"image\": {\n \"aspectRatio\": \"1:1\",\n \"imageSize\": \"1K\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"candidates": [
{
"content": {
"parts": [
{
"inlineData": {
"mimeType": "image/png",
"data": "<Base64 string of generated image>"
}
}
]
},
"finishReason": "STOP"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Required. Plain text is for image editing; text plus inlineData is for image editing.
1Hide child attributes
Hide child attributes
1Hide child attributes
Hide child attributes
Prompt words for generating or editing images.
Usually user or omitted.
user, model Nano Banana image output configuration.
Hide child attributes
Hide child attributes
Set to ["IMAGE"] when returning only images.
TEXT, IMAGE Hide child attributes
Hide child attributes
Hide child attributes
Hide child attributes
Target aspect ratio; available range varies by model.
1:1, 1:4, 1:8, 2:3, 3:2, 3:4, 4:1, 4:3, 4:5, 5:4, 8:1, 9:16, 16:9, 21:9 Target resolution; available range varies by model.
0.5K, 1K, 2K, 4K Response
Hide child attributes
Hide child attributes

