ساخت عکس با هوش مصنوعی نانو بنانا
تولید تصویر باکیفیت از روی متن (Text-to-Image) با ابعاد ۱۰۲۴×۱۰۲۴. با مدل نانو بنانا آخرین مدل جیمینی با بهترین کیفیت.
مشخصات
| مشخصه | مقدار |
|---|---|
| دستهبندی | هوش مصنوعی |
| وضعیت | فعال |
| نسخه API | apis-1 |
| فرمت پاسخ | JSON |
| آدرس پایه | https://open.nestapi.ir |
| مسیر | /apis-1/nano-banana |
| لینک کامل | https://open.nestapi.ir/apis-1/nano-banana |
متدهای HTTP
| متد | مسیر | نوع ورودی |
|---|---|---|
GET | /apis-1/nano-banana | Query String |
پارامترها
پارامترهای Query String
| نام | نوع | الزامی | پیشفرض | توضیحات |
|---|---|---|---|---|
prompt | string | بله | — | متن و توضیح تصویر مورد نظر، مثلاً a red bicycle on a beach at sunset |
ratio | string | خیر | — | نسبت ابعاد تصویر: 1:1، 16:9، 9:16، 3:2 یا 4:3 |
quality | string | خیر | — | کیفیت تصویر: low، medium، high، standard یا auto |
نمونه درخواست
لینک مستقیم
GET https://open.nestapi.ir/apis-1/nano-banana?prompt=a%20red%20bicycle%20on%20a%20beach%20at%20sunset
نمونه کد
- cURL
- PHP
- Python
- JavaScript
curl -X GET "https://open.nestapi.ir/apis-1/nano-banana?prompt=a%20red%20bicycle%20on%20a%20beach%20at%20sunset"
<?php
// composer require nestapi/nestapi
require 'vendor/autoload.php';
use NestApi\NestApi;
use NestApi\Exception\ApiException;
use NestApi\Exception\TransportException;
$api = new NestApi();
try {
$response = $api->nanoBanana(prompt: 'a red bicycle on a beach at sunset');
print_r($response->data);
} catch (ApiException $e) {
// Error reported by the API (validation, not found, rate limit, ...)
echo $e->getMessage();
} catch (TransportException $e) {
// Network error or unusable response; not a subclass of ApiException
echo 'Network error: ' . $e->getMessage();
}
# pip install nestapi-py
from nestapi import ApiError, NestApi, TransportError
with NestApi() as api:
try:
response = api.nano_banana(prompt="a red bicycle on a beach at sunset")
print(response.data)
except ApiError as e:
# Error reported by the API (validation, not found, rate limit, ...)
print(e.error_code, e)
except TransportError as e:
# Network error or unusable response; not a subclass of ApiError
print("Network error:", e)
// npm install @devh3n/nestapi
import { ApiError, NestApi, TransportError } from "@devh3n/nestapi";
const api = new NestApi();
try {
const response = await api.nanoBanana({ prompt: "a red bicycle on a beach at sunset" });
console.log(response.data);
} catch (error) {
if (error instanceof ApiError) {
// Error reported by the API (validation, not found, rate limit, ...)
console.error(error.errorCode, error.message);
} else if (error instanceof TransportError) {
// Network error or unusable response; not a subclass of ApiError
console.error("Network error:", error.message);
}
}
کدهای خطا
| کد | وضعیت | علت |
|---|---|---|
NOT_FOUND | 404 | مسیر وجود ندارد، یا متد روی آن ثبت نشده |
PARAM_NOT_FOUND | 400 | پارامتر لازم ارسال نشده |
VALIDATION_ERROR | 422 | پارامتر آمده ولی نوع، قالب یا بازهاش نادرست است |
SERVICE_UNAVAILABLE | 502 | سرویس تولید تصویر موقتاً در دسترس نیست |
SESSION_EXPIRED | 401 | نشست سرویس تولید تصویر منقضی شده است |
GENERATION_FAILED | 502 | تولید تصویر توسط هوش مصنوعی با خطا مواجه شد |
GENERATION_TIMEOUT | 504 | مدت زمان ساخت تصویر به پایان رسید |
DOWNLOAD_FAILED | 502 | خطا در دانلود محتوا از سرور |
QUOTA_EXCEEDED | 429 | سهمیه تولید تصویر در حال حاضر به پایان رسیده است |