GPT Image 2 API
Интеграция
openai/gpt-image-2
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/openai/gpt-image-2?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/openai/gpt-image-2?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openai/gpt-image-2", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/ru/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.ru/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "openai/gpt-image-2",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
}
Вызовите модель GPT Image 2 API (openai/gpt-image-2) через Doitong API. Документация для агентов: https://doitong.com/ru/developers/models/openai/gpt-image-2.md
POST https://api.doitong.ru/v1/run/openai/gpt-image-2?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
Если статус ответа — "queued" или "running", выполняйте опрос GET https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20, пока он не станет "succeeded"; файлы находятся в outputs[].url. POST https://api.doitong.ru/v1/quote/openai/gpt-image-2 с тем же телом возвращает точную цену до запуска.
Этот запрос: ≈0,106 $ 106 API-кредитов · ≈ 11,18 ₽ Запустить на этой странице
Ваш новый API-ключ. Он отображается только сейчас и уже вставлен в код и поле API-ключа ниже. Храните его в секрете: никогда не помещайте его в код, выполняемый в браузере.
Создано на Doitong
Публичные работы сообщества Doitong, созданные с помощью GPT Image 2 API. Повторно используйте промпт одним нажатием.
Grungy analog photo of Daphne Blake (from Serial scooby doo) watching her own movie on a 90s CRT TV in a dimly lit bedroom. The TV clearly shows animated scene from scooby doo, with a cartoon-style Daphne in her classic clothes on screen, smiling. Daphne Blake is sitting cross-legged on the floor...
Strong rule: style --- 3D Pixar ---. Молодая женщина около 30 лет, утонченные черты лица, высокие скулы, пронзительные зеленые глаза. Волосы уложены в безупречное каре каштанового цвета. Одета в дорогой шелковый бежевый блейзер и изящные золотые украшения. Образ излучает уверенность, строгость и...
Strong rule: style --- 3D Pixar ---. Девушка 25 лет с мягкими чертами лица и мечтательным, немного грустным взглядом карих глаз. Длинные вьющиеся рыжие волосы рассыпаны по плечам в легком беспорядке. Одета в уютный объемный вязаный свитер лавандового цвета и несколько тонких серебряных цепочек. В...
Art style: Realistic Photography. Самат в динамичной позе, идет по современному бизнес-центру. Качественный ростовой кадр, размытый фон. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FINAL STYLE ENFORCEMENT (this is the authoritative rendering directive — it overrides any style wording elsewhere in the...
[Lighting: natural] Art style: Cinematic Realistic. "Vibrant cartoon promo title screen: 'Утренний ритуал дружбы' in playful font, three coffee cups clinking, warm morning light, excited abstract friend silhouettes. Cartoon style." ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FINAL STYLE ENFORCEMENT...
[Lighting: natural] Art style: Cinematic Realistic. Three stylish women in a sunlit cozy living room of a friend's house, clinking white porcelain coffee cups. Keti in a sharp blazer, Meti in a soft knit sweater, Seti in a bright denim jacket. Golden morning light through large windows creates a...
Art style: 3D Pixar. Beggar in a cardboard box on the street outside a modern glass building. Lemenita walking past looking disgusted. 3D Pixar style. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FINAL STYLE ENFORCEMENT (this is the authoritative rendering directive — it overrides any style wording...
Art style: Pencil Sketch. Анна идет по солнечному парку, её походка легкая и уверенная. Она смеется, разговаривая с кем-то невидимым за кадром. Вокруг неё расцветают цветы, а солнечные блики играют на траве. В её руке — стильный кожаный аксессуар, намекающий на достаток. Атмосфера изобилия и...
Art style: Pencil Sketch. Крупный план глаза Анны. В зрачке, как в зеркале, отражается старый телевизионный экран с помехами и искаженным изображением маленькой девочки. Лицо Анны наполовину скрыто тенью. Освещение резкое, создающее эффект цифрового глитча. Атмосфера тревожного узнавания...
Art style: Pencil Sketch. Визуализация слов, вылетающих изо рта Анны и превращающихся в серый пепел, прежде чем они достигнут земли. Она говорит, но её взгляд пуст. Комната на заднем плане кажется выцветшей и безжизненной. Атмосфера тщетности усилий. Цветовая гамма монохромная с редкими...
[Lighting: natural] Art style: Cinematic Realistic. Keti and Meti sitting close on sofa in cozy living room, faces showing deep hurt and disappointment, eyes misty. Keti twists ring nervously, Meti clutches her cup sadly. Dramatic side lighting casts emotional shadows. Muted colors, intimate...
[Lighting: natural] Art style: Cinematic Realistic. Three cappuccino cups in a triangle on coffee table, third one untouched before empty armchair in cozy living room. Napkin crumpled nearby, steam fading from the lonely cup. Melancholic shadows, soft ochre tones, sense of absence. Detailed foam...
[Lighting: natural] Art style: Cinematic Realistic. Close-up of Meti looking worried at her smartphone in a cozy sunlit living room, empty chat with Seti. Keti in background paces anxiously, checking the door. Tension builds with cooler lighting and shadows. Emotional micro-expressions of...
[Lighting: natural] Art style: Cinematic Realistic. Three stylish women in a sunlit cozy living room of a friend's house, clinking white porcelain coffee cups. Keti in a sharp blazer, Meti in a soft knit sweater, Seti in a bright denim jacket. Golden morning light through large windows creates a...
Strong rule: style --- 3D Pixar ---. Энергичная девушка 27 лет с широкой лучезарной улыбкой и задорными искорками в темных глазах. Короткая стильная стрижка пикси, волосы выкрашены в модный пепельный блонд. Одета в яркую джинсовую куртку с цветными нашивками и белую футболку. Образ неформальный,...
Art style: Realistic Photography. Крупный план, прямой зрительный контакт. Открытая поза, легкая улыбка. Фон — стильный интерьер в сине-серых тонах. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ FINAL STYLE ENFORCEMENT (this is the authoritative rendering directive — it overrides any style wording...
Сформировать запрос
Элементы управления сгенерированы из схемы модели. Код и цена обновляются при изменении параметров.
/run/openai/gpt-image-2?wait=20
стоимость → 0,106 $
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/openai/gpt-image-2?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.ru/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.ru/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/openai/gpt-image-2?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.ru/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/openai/gpt-image-2", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "openai/gpt-image-2",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"wait_seconds": 20
}
}
}
Запустить этот запрос
Ваш ключ хранится в этом браузере: он отправляется только в Doitong API и сохраняется в localStorage только при включении параметра «Запомнить». Получить API-ключ
О GPT Image 2 API
Генерирует изображения из промпта длиной до 32000 символов. `image_size` принимает пресеты, auto или явные ширину и высоту; оба измерения должны быть кратны 16, а максимальная сторона — 3840px. Доступны качества auto, low, medium или high, до 4 изображений за вызов в форматах png, jpeg или webp.
Параметры
Передавайте либо каноническое имя, либо исходное имя, но не оба. Канонические имена
promptобязательно
image_sizeнеобязательно
backgroundнеобязательно
qualityнеобязательно
num_imagesнеобязательно
num_outputs
output_formatнеобязательно
enable_safety_checkerнеобязательно
Результат
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "openai/gpt-image-2",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 106,
"usd": "0.106",
"charged": 106,
"refunded": 0
},
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"output": {
"images": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768
}
]
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
Поля результата
- images
- array of object {url, content_type, file_name, file_size, width, height}Изображения, созданные моделью.
Другие варианты GPT Image 2 API
Другие модели: Текст в изображение
Для AI-агентов: эта страница в формате Markdown доступна по адресу https://doitong.com/ru/developers/models/openai/gpt-image-2.md. Все модели и руководства: https://doitong.com/developers/llms.txt







