GPT Image 2
curl --request POST \
--url https://api.goenhance.ai/api/v1/gpt-image-2 \
--header 'Content-Type: application/json' \
--data '
{
"args": {
"prompt": "a beautiful girl",
"image_size": "1k",
"quality": "low"
}
}
'import requests
url = "https://api.goenhance.ai/api/v1/gpt-image-2"
payload = { "args": {
"prompt": "a beautiful girl",
"image_size": "1k",
"quality": "low"
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({args: {prompt: 'a beautiful girl', image_size: '1k', quality: 'low'}})
};
fetch('https://api.goenhance.ai/api/v1/gpt-image-2', 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.goenhance.ai/api/v1/gpt-image-2",
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([
'args' => [
'prompt' => 'a beautiful girl',
'image_size' => '1k',
'quality' => 'low'
]
]),
CURLOPT_HTTPHEADER => [
"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.goenhance.ai/api/v1/gpt-image-2"
payload := strings.NewReader("{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.goenhance.ai/api/v1/gpt-image-2")
.header("Content-Type", "application/json")
.body("{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/gpt-image-2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5"
}
}Image API
GPT Image 2 API
Pricing (tokens/image, USD at $0.02/token) — aligned to OpenAI gpt-image-2 cost (official x1.3):
| quality | 1k | 2k | 4k |
|---|---|---|---|
| low | 0.39 ($0.008) | 0.78 ($0.016) | 1.17 ($0.023) |
| medium | 3.45 ($0.069) | 6.9 ($0.138) | 10.35 ($0.207) |
| high | 13.72 ($0.274) | 27.44 ($0.549) | 41.16 ($0.823) |
Returns an img_uuid; poll GET /api/v1/jobs/detail (or use custom_callback_url) to get the generated image.
POST
/
api
/
v1
/
gpt-image-2
GPT Image 2
curl --request POST \
--url https://api.goenhance.ai/api/v1/gpt-image-2 \
--header 'Content-Type: application/json' \
--data '
{
"args": {
"prompt": "a beautiful girl",
"image_size": "1k",
"quality": "low"
}
}
'import requests
url = "https://api.goenhance.ai/api/v1/gpt-image-2"
payload = { "args": {
"prompt": "a beautiful girl",
"image_size": "1k",
"quality": "low"
} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({args: {prompt: 'a beautiful girl', image_size: '1k', quality: 'low'}})
};
fetch('https://api.goenhance.ai/api/v1/gpt-image-2', 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.goenhance.ai/api/v1/gpt-image-2",
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([
'args' => [
'prompt' => 'a beautiful girl',
'image_size' => '1k',
'quality' => 'low'
]
]),
CURLOPT_HTTPHEADER => [
"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.goenhance.ai/api/v1/gpt-image-2"
payload := strings.NewReader("{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
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.goenhance.ai/api/v1/gpt-image-2")
.header("Content-Type", "application/json")
.body("{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.goenhance.ai/api/v1/gpt-image-2")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"args\": {\n \"prompt\": \"a beautiful girl\",\n \"image_size\": \"1k\",\n \"quality\": \"low\"\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 0,
"msg": "Success",
"data": {
"img_uuid": "c12b656c-747a-44fd-9c80-add79b0c52d5"
}
}⌘I
