GPT-4o-image Image Generation
curl --request POST \
--url https://apiif.com/v1/images/generations/gpt-4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiif.com/v1/images/generations/gpt-4o-image"
payload := strings.NewReader("{\n \"model\": \"gpt-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\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://apiif.com/v1/images/generations/gpt-4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\n}")
.asString();const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o-image',
prompt: 'An ancient castle under the starry sky',
size: '1:1',
n: 1
})
};
fetch('https://apiif.com/v1/images/generations/gpt-4o-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://apiif.com/v1/images/generations/gpt-4o-image';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o-image',
prompt: 'An ancient castle under the starry sky',
size: '1:1',
n: 1
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiif.com/v1/images/generations/gpt-4o-image",
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-4o-image',
'prompt' => 'An ancient castle under the starry sky',
'size' => '1:1',
'n' => 1
]),
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;
}$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://apiif.com/v1/images/generations/gpt-4o-image' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}'import requests
url = "https://apiif.com/v1/images/generations/gpt-4o-image"
payload = {
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://apiif.com/v1/images/generations/gpt-4o-image")
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-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\n}"
response = http.request(request)
puts response.read_bodyimport Foundation
let parameters = [
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://apiif.com/v1/images/generations/gpt-4o-image")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self)){
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}{
"error": {
"code": 123,
"message": "<string>",
"type": "<string>"
}
}Image Series
GPT-4o-image Image Generation
Asynchronous image generation (gpt-4o-image). Supports text-to-image, image-to-image and editing.
POST
/
v1
/
images
/
generations
/
gpt-4o-image
GPT-4o-image Image Generation
curl --request POST \
--url https://apiif.com/v1/images/generations/gpt-4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}
'package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://apiif.com/v1/images/generations/gpt-4o-image"
payload := strings.NewReader("{\n \"model\": \"gpt-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\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://apiif.com/v1/images/generations/gpt-4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\n}")
.asString();const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o-image',
prompt: 'An ancient castle under the starry sky',
size: '1:1',
n: 1
})
};
fetch('https://apiif.com/v1/images/generations/gpt-4o-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));const url = 'https://apiif.com/v1/images/generations/gpt-4o-image';
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-4o-image',
prompt: 'An ancient castle under the starry sky',
size: '1:1',
n: 1
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://apiif.com/v1/images/generations/gpt-4o-image",
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-4o-image',
'prompt' => 'An ancient castle under the starry sky',
'size' => '1:1',
'n' => 1
]),
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;
}$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://apiif.com/v1/images/generations/gpt-4o-image' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}'import requests
url = "https://apiif.com/v1/images/generations/gpt-4o-image"
payload = {
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://apiif.com/v1/images/generations/gpt-4o-image")
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-4o-image\",\n \"prompt\": \"An ancient castle under the starry sky\",\n \"size\": \"1:1\",\n \"n\": 1\n}"
response = http.request(request)
puts response.read_bodyimport Foundation
let parameters = [
"model": "gpt-4o-image",
"prompt": "An ancient castle under the starry sky",
"size": "1:1",
"n": 1
] as [String : Any?]
let postData = try JSONSerialization.data(withJSONObject: parameters, options: [])
let url = URL(string: "https://apiif.com/v1/images/generations/gpt-4o-image")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
]
request.httpBody = postData
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self)){
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01K8SGYNNNVBQTXNR4MM964S7K"
}
]
}{
"error": {
"code": 123,
"message": "<string>",
"type": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Image generation model name
Text description for image generation
Aspect ratio (e.g., 1:1, 16:9)
Output resolution (1K/2K/4K)
Number of images to generate
Required range:
1 <= x <= 15Reference image URLs (for image-to-image / editing)
Mask image URL (PNG) for editing
Whether to add a watermark
Controls sequential generation (auto/disabled)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Task submitted
⌘I