الانتقال إلى الوثائق
في هذه الصفحة

Nano Banana API

Generate one image asynchronously per request. Supports text-to-image and image-to-image generation with your Seevio API key.

POST https://api.seevio.ai/v1/images/generations

الإمكانيات

الميزةالقيم المدعومة
أوضاع التوليدtext-to-image, image-to-image
دقة المخرجاتinput.resolutionNot accepted for this model.
نسبة العرض إلى الارتفاعauto, 1:1, 9:16, 16:9, 3:4, 4:3, 3:2, 2:3, 5:4, 4:5, 21:9
الصور المرجعيةPublic HTTPS PNG / JPEG / WebP URLs. Image-to-image requires 1–10 images, each up to 10 MB. Text-to-image requires an empty array.
الوصف النصيRequired non-empty prompt, up to 5000 characters.
تنسيق الإخراجpng, jpg

الأسعار والأرصدة

Each image costs 2 credits, including all supported resolutions and formats. Credits are reserved on acceptance, settled on success and refunded on failure. Generation times out after 30 minutes; refund_failed means refund recovery is pending.

Request idempotency is not supported. Each valid POST creates a new billable task. If a submission outcome is uncertain, query the returned taskId; retrying POST can create another task.

المصادقة

أنشئ مفتاح API في لوحة التحكم. يظهر المفتاح الكامل مرة واحدة فقط. احتفظ به في خادمك وأرسله كرمز حامل (Bearer token) مع كل طلب.

رابط الأساس (Base URL)

https://api.seevio.ai
Authorization: Bearer sk_live_your_api_key
Content-Type: application/json

قم بتعيين متغير البيئة SEEVIO_API_KEY قبل تشغيل هذه الأمثلة. يتم تشغيل أمثلة JavaScript على خادمك باستخدام Node.js؛ وتستخدم أمثلة Python حزمة requests.

جسم الطلب (Request body)

الحقلالنوعمطلوبالوصف والقيود
model
stringنعم

معرّف النموذج. لاستخدام Nano Banana، عيّن قيمة هذا الحقل إلى nano-banana.

callback_url
stringلا

نقطة نهاية HTTPS عامة لاستلام استجابات POST عند الاكتمال أو الفشل. الشبكات الخاصة والاستضافة المحلية (localhost) غير مسموح بها.

مثال: https://example.com/webhooks/seevio
input
objectنعم

إعدادات التوليد. يجب أن تحتوي على وصف (prompt) غير فارغ.

معلمات الإدخال

الحقلالنوعمطلوبافتراضيالوصف والقيود
input.prompt
stringنعم

Required non-empty prompt, up to 5000 characters.

مثال: A minimalist ceramic teapot on a stone pedestal, soft studio lighting
input.generation_type
stringلاtext-to-image

For image editing, set generation_type to image-to-image and provide image_urls. All other parameters use the same contract.

القيم المدعومة
text-to-image | image-to-image
input.image_urls
string[]مشروط[]

Public HTTPS PNG / JPEG / WebP URLs. Image-to-image requires 1–10 images, each up to 10 MB. Text-to-image requires an empty array.

مثال: ["https://example.com/teapot.png"]
input.aspect_ratio
stringلاauto

نسبة العرض إلى الارتفاع

القيم المدعومة
auto | 1:1 | 9:16 | 16:9 | 3:4 | 4:3 | 3:2 | 2:3 | 5:4 | 4:5 | 21:9
مثال: 1:1
input.resolution
stringغير مدعوم

Not accepted for this model.

input.output_format
stringلاpng
القيم المدعومة
png | jpg
مثال: png

Aspect ratio defaults to auto. Unknown fields, including output quantity, are rejected. Each request generates exactly one image.

البدء السريع

أرسل هذا الطلب البسيط، واحفظ الـ taskId المسترجع، ثم استخدم مثال الاستعلام عن المهمة أدناه. قيمة الرصيد في استجابة الإنشاء تمثل المبلغ المحجوز.

curl --fail-with-body https://api.seevio.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEVIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "nano-banana",
  "input": {
    "prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
    "aspect_ratio": "1:1",
    "output_format": "png",
    "generation_type": "text-to-image"
  }
}'

مثال على استجابة إنشاء المهمة

{
  "taskId": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "credits": 2
}

تحويل النص إلى صورة

Generate one image asynchronously per request. Supports text-to-image and image-to-image generation with your Seevio API key.

curl --fail-with-body https://api.seevio.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEVIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "nano-banana",
  "input": {
    "prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
    "aspect_ratio": "1:1",
    "output_format": "png",
    "generation_type": "text-to-image"
  }
}'

تحويل صورة إلى صورة

For image editing, set generation_type to image-to-image and provide image_urls. All other parameters use the same contract.

استبدل عناوين URL الخاصة بالوسائط في example.com بملفات HTTPS الخاصة بك والمتاحة للعامة. عناوين URL التجريبية مخصصة لتوضيح هيكلية الطلب وليست أصولاً صالحة للتنزيل.

curl --fail-with-body https://api.seevio.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEVIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "nano-banana",
  "input": {
    "prompt": "Change the teapot to matte sage green. Preserve its shape and the studio lighting.",
    "aspect_ratio": "1:1",
    "output_format": "png",
    "generation_type": "image-to-image",
    "image_urls": [
      "https://example.com/teapot.png"
    ]
  }
}'

الاستعلام عن مهمة

GET https://api.seevio.ai/v1/tasks/{taskId}

استبدل معرف المثال بـ taskId المسترجع من عملية الإنشاء. تعيد الاستعلامات فقط المهام المملوكة لمستخدم مفتاح API؛ وتعيد المعرفات غير المعروفة أو التي لا يمكن الوصول إليها خطأ HTTP 404.

استعلم كل 10–20 ثوانٍ كخطوة أولى، وتراجع مؤقتًا عند تلقي HTTP 429، وتوقف عندما تصبح الحالة completed أو failed. يُفضل استخدام خطاطيف الويب (webhooks) في بيئة الإنتاج. يقوم كل مثال كود أدناه باستعلام واحد.

curl --fail-with-body https://api.seevio.ai/v1/tasks/3f2aK9mR7xQp4TnZ8bLc6YwH \
  -H "Authorization: Bearer $SEEVIO_API_KEY"
الحالةAllowed values and requirements
queuedتم القبول وفي انتظار التقديم.
generatingعملية التوليد قيد المعالجة حاليًا.
completedنجاح نهائي. قم بتنزيل data.results قبل انتهاء الصلاحية.
failedفشل نهائي. تحقق من failed_reason و billing_status.
FieldالنوعAllowed values and requirements
idstringمعرف المهمة. هذا هو taskId المسترجع من استجابة الإنشاء.
created_atnumberوقت إنشاء المهمة بثواني Unix.
modelstringمعرف النموذج العام المستخدم لهذه المهمة.
billing_statusstringreserved (محجوز)، charged (مخصوم)، refunded (مسترد)، أو refund_failed (فشل الاسترد).
creditsnumberالأرصدة المحجوزة لهذه المهمة. يتم الاحتفاظ بهذه القيمة بعد الاسترداد؛ تحقق من billing_status لمعرفة النتيجة النهائية للفوترة.
failed_reasonstring | nullسبب الفشل للمهام الفاشلة؛ ويكون null في الحالات الأخرى. تحذف استجابات الاستعلام الفاشلة حقل data.
dataobjectيكون متواجدًا في استعلامات المهام غير الفاشلة. يحتوي على تفاصيل المخرجات والمعالجة.
data.resultsstring[]مصفوفة روابط الصور؛ فارغة قبل الاكتمال وبعد انتهاء الصلاحية.
data.image_expires_atstring | nullوقت انتهاء صلاحية الصور بتنسيق ISO 8601، أو null إذا لم يتوفر بعد.
data.processing_timenumber | nullمدة معالجة المزود بالثواني عند توفرها، وإلا تكون null.

في قائمة الانتظار

{
  "id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "created_at": 1789171200,
  "model": "nano-banana",
  "credits": 2,
  "status": "queued",
  "billing_status": "reserved",
  "failed_reason": null,
  "data": {
    "results": [],
    "image_expires_at": null,
    "processing_time": null
  }
}

اكتملت

{
  "id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "created_at": 1789171200,
  "model": "nano-banana",
  "credits": 2,
  "status": "completed",
  "billing_status": "charged",
  "failed_reason": null,
  "data": {
    "results": [
      "https://cdn.seevio.ai/api/images/example.png"
    ],
    "image_expires_at": "2026-10-12T00:00:00.000Z",
    "processing_time": 12
  }
}

فشلت

عندما ترجع نتيجة الاستعلام status=failed، فهذا يعني أن عملية الإنشاء قد انتهت دون نجاح. يمكنك قراءة سبب الفشل من failed_reason وحالة الفوترة من billing_status لمعرفة تفاصيل عملية الاسترداد. في هذا المثال، تعني refunded أنه تمت إعادة الرصيد المحجوز. يحتفظ الحقل credits بالقيمة الأصلية المحجوزة، ولا تتضمن الاستجابة أي بيانات في data.

{
  "id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "created_at": 1789171200,
  "model": "nano-banana",
  "credits": 2,
  "status": "failed",
  "billing_status": "refunded",
  "failed_reason": "Image generation failed."
}

Result links are provided for 30 days after storage. After expiry, results is empty.

خطاطيف الويب (Webhooks)

اضبط callback_url في طلب الإنشاء لتلقي طلب JSON POST عند اكتمال المهمة أو فشلها. يجب إرجاع استجابة بترميز 2xx في غضون 15 ثانية. تتم إعادة المحاولة للإرسال الفاشل؛ لذا يرجى معالجة الطلبات المتكررة بشكل متطابق (idempotently) باستخدام معرف المهمة.

يجب أن تدعم نقطة نهاية الاستدعاء الذاتي (Callback endpoint) استقبال طلبات من نوع POST مع نص طلب بتنسيق JSON ‏(Content-Type: application/json).

إنشاء مهمة مع تعيين خطاف الويب (callback)

curl --fail-with-body https://api.seevio.ai/v1/images/generations \
  -H "Authorization: Bearer $SEEVIO_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "nano-banana",
  "input": {
    "prompt": "A minimalist ceramic teapot on a stone pedestal, soft studio lighting",
    "aspect_ratio": "1:1",
    "output_format": "png",
    "generation_type": "text-to-image"
  },
  "callback_url": "https://example.com/webhooks/seevio"
}'

Callbacks use the task query response structure; refunded failure notifications also include top-level credits_refunded. Use id to identify the task and status to distinguish completed from failed. Notifications may repeat: process them idempotently by id and status. Callbacks are unsigned; verify the task with the authenticated query endpoint. Delivery failure does not refund a successful task.

اكتملت المهمة: بيانات الاستدعاء الذاتي الناجح

يشير created_at إلى وقت إنشاء الحدث، وtask_created_at إلى وقت إنشاء المهمة، بالثواني وفق Unix. تعرض الأمثلة الحقول الموصى بها؛ وقد تتضمن الاستجابات حقولاً إضافية.

{
  "id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "created_at": 1789171212,
  "model": "nano-banana",
  "credits": 2,
  "status": "completed",
  "billing_status": "charged",
  "failed_reason": null,
  "data": {
    "results": [
      "https://cdn.seevio.ai/api/images/example.png"
    ],
    "image_expires_at": "2026-10-12T00:00:00.000Z",
    "processing_time": 12
  },
  "task_created_at": 1789171200
}

فشلت المهمة: بيانات استدعاء ذاتي غير ناجح

{
  "id": "3f2aK9mR7xQp4TnZ8bLc6YwH",
  "created_at": 1789171212,
  "model": "nano-banana",
  "credits": 2,
  "status": "failed",
  "billing_status": "refunded",
  "failed_reason": "Image generation failed.",
  "task_created_at": 1789171200,
  "credits_refunded": 2
}

مثال للمستقبل (Receiver)

export async function POST(request: Request) {
  const callbackData = await request.json();

  if (callbackData.status === "completed") {
    const imageUrls = callbackData.data.results;
    // Save the image URLs and mark this task as completed in your application.
    console.log(callbackData.id, imageUrls);
  }

  if (callbackData.status === "failed") {
    const { failed_reason, credits_refunded } = callbackData;
    // Record the failure reason and refunded credits for this task.
    console.error(callbackData.id, failed_reason, credits_refunded);
  }

  return new Response(null, { status: 200 });
}

يقرأ نموذج Next.js هذا نص استجابة JSON للتعامل مع المهام المكتملة والفاشلة مباشرةً. يُرجى إضافة ميزة الحفظ الدائم وتجنب تكرار معرفات المهام (Task-ID) في تطبيقك، مع جدولة المهام البطيئة في قائمة انتظار قبل تأكيد الاستدعاء الذاتي.

الأخطاء

تحتوي أخطاء HTTP على كائن خطأ يضم الرمز (code) والرسالة (message). يمكن للمهمة المقبولة بنجاح أن تفشل لاحقًا؛ لذا استعلم عن المهمة أو تعامل مع خطاك الراجع للفشل.

{
  "error": {
    "code": "invalid_request",
    "message": "input.prompt is required."
  }
}
HTTPالحقلالإجراء المطلوب
400invalid_request
قم بتصحيح الـ JSON، أو الوصف المفقود، أو نطاق المعلمات، أو رابط الوسائط قبل إعادة المحاولة.
401invalid_api_key
تحقق من الرمز الحامل (Bearer token) وما إذا كان مفتاح الـ API نشطًا.
402insufficient_credits
أضف رصيدًا أو قلل من تكلفة المهمة. قد تتضمن الاستجابة المبالغ المطلوبة والمتاحة.
403forbidden
يرجى التحقق من القيود المفروضة على الحساب والموضحة في رسالة الخطأ.
404not_found
تحقق من معرف المهمة وتأكد من أن المفتاح ينتمي لمستخدم المهمة.
429rate_limited
انتظر للمدة المحددة في Retry-After قبل إعادة المحاولة.
500internal_error
تحقق من رسالة الخطأ وسجلات الـ API. أعد المحاولة بحذر؛ حيث يمكن أن يؤدي إعادة إرسال طلب الإنشاء إلى إنشاء مهمة أخرى خاضعة للرسوم.

Errors use error.code and error.message: 400 invalid_request, 401 invalid_api_key, 402 insufficient_credits, 403 forbidden, 404 not_found, 429 rate_limited, 500 internal_error. Insufficient provider balance is not a customer 402 error.

حدود معدل الطلبات

إنشاء المهام: يتيح كل مفتاح واجهة برمجة تطبيقات (API key) ما يصل إلى 100 طلب في الدقيقة افتراضيًا. حدود معدل الطلبات المخصصة غير متوفرة حاليًا.

الاستعلام عن المهام: يتيح كل مفتاح واجهة برمجة تطبيقات (API key) ما يصل إلى 120 طلبًا في الدقيقة افتراضيًا. ويتم احتساب طلبات الاستعلام وطلبات إنشاء المهام بشكل منفصل.

Image and video creation requests share the same API key rate limit.

يتضمن خطأ HTTP 429 الرأس Retry-After: 60 لعمليات الإنشاء، والرأس Retry-After: 5 للاستعلامات. استخدم التراجع التدريجي وتجنب الاستقصاء بمعدل أكبر من اللازم.

HTTP/1.1 429 Too Many Requests
Content-Type: application/json
Retry-After: 60
{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded."
  }
}