GPT-4o Image Generation
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/gpt4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "1:1",
"filesUrl": [
""
],
"isEnhance": false,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/gpt4o-image"
payload = {
"size": "1:1",
"filesUrl": [""],
"isEnhance": False,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
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({
size: '1:1',
filesUrl: [''],
isEnhance: false,
maskUrl: '',
nVariants: 1,
prompt: 'A beautiful sunset over the mountains'
})
};
fetch('https://api.sinancode.com/v1/generate/k/gpt4o-image', 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.sinancode.com/v1/generate/k/gpt4o-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([
'size' => '1:1',
'filesUrl' => [
''
],
'isEnhance' => false,
'maskUrl' => '',
'nVariants' => 1,
'prompt' => 'A beautiful sunset over the mountains'
]),
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.sinancode.com/v1/generate/k/gpt4o-image"
payload := strings.NewReader("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\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.sinancode.com/v1/generate/k/gpt4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/gpt4o-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 \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}Image Generation - GPT4o
GPT-4o Image
Generate images using OpenAI GPT-4o model (async)
POST
/
generate
/
k
/
gpt4o-image
GPT-4o Image Generation
curl --request POST \
--url https://api.sinancode.com/v1/generate/k/gpt4o-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"size": "1:1",
"filesUrl": [
""
],
"isEnhance": false,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
'import requests
url = "https://api.sinancode.com/v1/generate/k/gpt4o-image"
payload = {
"size": "1:1",
"filesUrl": [""],
"isEnhance": False,
"maskUrl": "",
"nVariants": 1,
"prompt": "A beautiful sunset over the mountains"
}
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({
size: '1:1',
filesUrl: [''],
isEnhance: false,
maskUrl: '',
nVariants: 1,
prompt: 'A beautiful sunset over the mountains'
})
};
fetch('https://api.sinancode.com/v1/generate/k/gpt4o-image', 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.sinancode.com/v1/generate/k/gpt4o-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([
'size' => '1:1',
'filesUrl' => [
''
],
'isEnhance' => false,
'maskUrl' => '',
'nVariants' => 1,
'prompt' => 'A beautiful sunset over the mountains'
]),
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.sinancode.com/v1/generate/k/gpt4o-image"
payload := strings.NewReader("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\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.sinancode.com/v1/generate/k/gpt4o-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/k/gpt4o-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 \"size\": \"1:1\",\n \"filesUrl\": [\n \"\"\n ],\n \"isEnhance\": false,\n \"maskUrl\": \"\",\n \"nVariants\": 1,\n \"prompt\": \"A beautiful sunset over the mountains\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}Create and edit images using OpenAI’s GPT-4o native image generation capabilities.
Key Features:
- Native Multimodal - Image generation built into GPT-4o architecture, not external model calls
- Precise Text Rendering - Significantly better text generation than DALL·E 3
- Multi-Turn Consistency - Refine images through natural conversation while maintaining style coherence
- Image Understanding & Editing - Support uploading images as input for understanding and transformation
Authorizations
Please use your API Token for authentication
Body
application/json
Task parameters
Size (required) - Image aspect ratio, must be one of the supported formats
Available options:
1:1, 3:2, 2:3 Example:
"1:1"
File URL list (optional) - File URL list, max 5 images
Example:
[""]
Enable enhancement (optional) - Prompt enhancement, default false
Example:
false
Mask URL (optional) - Mask image URL for editing, black areas will be replaced/modified
Example:
""
Number of variants (optional) - Number of image variants, options 1, 2 or 4, default 1
Available options:
1, 2, 4 Example:
1
Prompt (optional) - Describe the content you want GPT-4o to generate
Example:
"A beautiful sunset over the mountains"
Response
OK
Task ID
Example:
"01234567-89ab-cdef-0123-456789abcdef"