Create response (OpenAI Responses API)
curl --request POST \
--url https://api.aiid.edu.kg/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
'import requests
url = "https://api.aiid.edu.kg/v1/responses"
payload = {
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": False,
"tools": [{ "type": "image_generation" }],
"background": True
}
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({
model: 'gpt-image-2-2k',
input: '生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。',
stream: false,
tools: [{type: 'image_generation'}],
background: true
})
};
fetch('https://api.aiid.edu.kg/v1/responses', 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.aiid.edu.kg/v1/responses",
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-image-2-2k',
'input' => '生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。',
'stream' => false,
'tools' => [
[
'type' => 'image_generation'
]
],
'background' => true
]),
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.aiid.edu.kg/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\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.aiid.edu.kg/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiid.edu.kg/v1/responses")
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-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}OpenAI Format (Responses)
Create response (OpenAI Responses API)
OpenAI Responses API, used to create model responses. Supports multi-turn conversations, tool calling, reasoning, and other features.
Add asynchronous image generation examples for OpenAI Responses API. background=true is used to submit background tasks; the create API returns status=queued and the full id immediately, then use that id to call GET /v1/responses/{response_id} to query the result.
Asynchronous image generation flow
- Call
POST /v1/responses, and passtools=[{ "type": "image_generation" }]andbackground=truein the request body. - Save the full
idreturned by the create API, for exampleresp_xxx. Do not truncate, rewrite, or save onlymetadata.task_id. - Call
GET /v1/responses/{response_id}to query untilstatus=completedorstatus=failed. - After success, read
output[].urlto get the image URL.
Example of creating an asynchronous image task
POST /v1/responses
Content-Type: application/json
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
Create API response example:
{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}
Supported models: gpt-image-2-2k, gpt-image-2-4k, and nano-banana-pro.
POST
/
v1
/
responses
Create response (OpenAI Responses API)
curl --request POST \
--url https://api.aiid.edu.kg/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
'import requests
url = "https://api.aiid.edu.kg/v1/responses"
payload = {
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": False,
"tools": [{ "type": "image_generation" }],
"background": True
}
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({
model: 'gpt-image-2-2k',
input: '生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。',
stream: false,
tools: [{type: 'image_generation'}],
background: true
})
};
fetch('https://api.aiid.edu.kg/v1/responses', 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.aiid.edu.kg/v1/responses",
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-image-2-2k',
'input' => '生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。',
'stream' => false,
'tools' => [
[
'type' => 'image_generation'
]
],
'background' => true
]),
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.aiid.edu.kg/v1/responses"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\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.aiid.edu.kg/v1/responses")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.aiid.edu.kg/v1/responses")
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-image-2-2k\",\n \"input\": \"生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。\",\n \"stream\": false,\n \"tools\": [\n {\n \"type\": \"image_generation\"\n }\n ],\n \"background\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}Authorizations
Use Bearer Token authentication.
Format: Authorization: Bearer sk-xxxxxx
Body
application/json
The body is of type object.
Response
200 - application/json
Response created successfully
Example:
"response"
Available options:
completed, failed, in_progress, incomplete Hide child attributes
Hide child attributes
Prompt Tokens
Completion Tokens
Total Tokens
