GPT-Image-2
curl --request POST \
--url https://api.tennda.ai/v1/images/generations \
--header 'Authorization: <authorization>'import requests
url = "https://api.tennda.ai/v1/images/generations"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.tennda.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.tennda.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_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tennda.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.tennda.ai/v1/images/generations")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tennda.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyImage Series
GPT-Image-2
OpenAI GPT-Image-2 text-to-image and image-to-image
POST
/
v1
/
images
/
generations
GPT-Image-2
curl --request POST \
--url https://api.tennda.ai/v1/images/generations \
--header 'Authorization: <authorization>'import requests
url = "https://api.tennda.ai/v1/images/generations"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.tennda.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.tennda.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_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tennda.ai/v1/images/generations"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.tennda.ai/v1/images/generations")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tennda.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyIntroduction
GPT-Image-2 usesPOST /v1/images/generations for both text-to-image and image-to-image: omit image for T2I; include image (URL or Base64) for I2I. Responses use b64_json with usage token stats.
For full parameters and other image models, see Image generation.
Authentication
string
required
Bearer Token, e.g.
Bearer sk-xxxxxxxxxxSupported models
| Model ID | Description |
|---|---|
gpt-image-2 | OpenAI GPT-Image-2, multi-size including 4K |
Request examples
- Text-to-image
- Image-to-image (generations)
- Image-to-image (edits)
curl -X POST "https://api.tennda.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A white cat running under the stars, cyberpunk style",
"size": "1024x1536",
"quality": "high",
"n": 1
}'
curl -X POST "https://api.tennda.ai/v1/images/generations" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Change the scene to night cyberpunk",
"image": "https://example.com/input.png",
"size": "1024x1024",
"quality": "high"
}'
curl -X POST "https://api.tennda.ai/v1/images/edits" \
-H "Authorization: Bearer sk-xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "Change background to beach sunset",
"image": "https://example.com/input.png",
"size": "1024x1024",
"quality": "high"
}'
Common parameters
- model:
gpt-image-2 - prompt: Description or edit instruction
- image: Reference image for I2I
- size: e.g.
1024x1024,1024x1536,2880x2880(dimensions multiple of 16) - quality:
low,medium,high - n: Number of images (1–10)
