I tried using the Gemini 2.5 Flash Image (nano-banana) with JS.

This article can be read in about 6 minutes.
PR

The purpose

I’ll try using Gemini 2.5 Flash Image (also known as nano-banana) in JavaScript, as it has been released. This model is said to be particularly good at image modification.

I tried the Gemini 2.5 Flash Image, but it failed. Here I’ll document the corrections and the reasons why it didn’t work.

Caution

As of the writing of this article (2025/08/29), it was not available for free use (according to Google, this applies to projects not linked to a billing account).

However, as the Gemini 2.5 Flash Image (nano-banana) is a newly released model, I believe there is a possibility that this will be corrected.

PR

What I’ve tried

Based on the following page, I will create the JavaScript code.

Gemini を使った画像生成(別名 Nano Banana)  |  Gemini API  |  Google AI for Developers
Gemini API を使用して画像を生成する

(The code won’t run as is. (The example is a server-side code for Node.js.))

Result

It failed.

Upon checking the browser’s logs, the following was output:

Failed to load resource: the server responded with a status of 429 ()
Understand this error
@google_genai.js?v=d283f444:7780 Uncaught (in promise) ClientError: got status: 429 . {"error":{"code":429,"message":"You exceeded your current quota, please check your plan and billing details. For more information on this error, head to: https://ai.google.dev/gemini-api/docs/rate-limits.","status":"RESOURCE_EXHAUSTED","details":[{"@type":"type.googleapis.com/google.rpc.QuotaFailure","violations":[{"quotaMetric":"generativelanguage.googleapis.com/generate_content_free_tier_requests","quotaId":"GenerateRequestsPerDayPerProjectPerModel-FreeTier","quotaDimensions":{"location":"global","model":"gemini-2.5-flash-preview-image"}},{"quotaMetric":"generativelanguage.googleapis.com/generate_content_free_tier_requests","quotaId":"GenerateRequestsPerMinutePerProjectPerModel-FreeTier","quotaDimensions":{"location":"global","model":"gemini-2.5-flash-preview-image"}},{"quotaMetric":"generativelanguage.googleapis.com/generate_content_free_tier_input_token_count","quotaId":"GenerateContentInputTokensPerModelPerMinute-FreeTier","quotaDimensions":{"location":"global","model":"gemini-2.5-flash-preview-image"}}]},{"@type":"type.googleapis.com/google.rpc.Help","links":[{"description":"Learn more about Gemini API quotas","url":"https://ai.google.dev/gemini-api/docs/rate-limits"}]},{"@type":"type.googleapis.com/google.rpc.RetryInfo","retryDelay":"2s"}]}}

Why did it fail?

When I check the logs, it says I’ve exceeded the quota. However, this error happens from the very first time I try.

Upon reading the linked page more carefully, I found that “Gemini 2.5 Flash Preview Image Generation” is not included in the free tier. (“Gemini 2.0 Flash Preview Image Generation” is available in the free tier.)

In other words, it means I can’t use “Gemini 2.5 Flash Preview Image Generation” with the free plan.

レート制限  |  Gemini API  |  Google AI for Developers

This limitation may be revised and become available for use in the future.

comment

Copied title and URL