APIИзображения
Nano Banana 2
Модель Google для генерации и редактирования изображений с выбором качества.
Nano Banana 2 подходит для text-to-image и image-to-image сценариев, где важны гибкие пропорции и качество результата.
POST https://braily.ru/api/v1/images/generationsПараметры
| Параметр | Значения | По умолчанию |
|---|---|---|
model | nano-banana-2 | - |
prompt | От 3 до 20000 символов | - |
image_reference | От 1 до 4 media_id для image-to-image | - |
parameters.aspect_ratio | 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16, 4:1, 1:4, 8:1, 1:8 | auto |
parameters.resolution | 1K, 2K, 4K | 2K |
Стоимость
| Разрешение | Токены |
|---|---|
1K | 20 |
2K | 30 |
4K | 40 |
Пример запроса
curl "https://braily.ru/api/v1/images/generations" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "nano-banana-2",
"prompt": "A cinematic fashion editorial portrait in soft daylight",
"parameters": {
"aspect_ratio": "3:4",
"resolution": "2K"
}
}'const response = await fetch("https://braily.ru/api/v1/images/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "nano-banana-2",
prompt: "A cinematic fashion editorial portrait in soft daylight",
parameters: {
aspect_ratio: "3:4",
resolution: "2K",
},
}),
});
const task = await response.json();Image-to-image
{
"model": "nano-banana-2",
"prompt": "Keep the person and outfit, change the background to a minimal studio",
"image_reference": ["media_123"],
"parameters": {
"resolution": "2K"
}
}Ответ 202 Accepted
{
"data": {
"task_id": "task_123",
"status": "CREATED",
"cost": 30,
"generated": []
}
}