The three values every integration needs
Nearly every guide to nanobanana api integration boils down to filling in the same three fields in a different place. The service speaks the OpenAI chat-completions protocol, so a tool that lets you override the OpenAI endpoint can talk to it.
| Field | Value |
|---|---|
| Base URL | https://api.nanobananaapis.com/v1 |
| API key | Your key, sent as Authorization: Bearer <key> |
| Model ID | uncensored |
One scope note before you start. This is a text language model, so it will not work in places that expect image generation, speech or embeddings. The supported methods are POST /v1/chat/completions and GET /v1/models. If a tool asks for an embeddings model for search, point that part at a different provider.
You get a key from the API key page. New accounts can claim $0.50 of trial credit with one click, with no card, valid for 7 days.
Test the endpoint before touching any tool
When an integration fails, people blame the tool. Most of the time the key or URL is wrong. A thirty-second curl test removes that doubt. First list the models:
curl https://api.nanobananaapis.com/v1/models -H "Authorization: Bearer YOUR_API_KEY"
Then send a short chat request:
curl https://api.nanobananaapis.com/v1/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{"model":"uncensored","messages":[{"role":"user","content":"Reply with the word ready."}],"max_tokens":10}'
If both work, the endpoint and the key are fine, and any later error comes from how a tool is configured. If the first call returns 401, the key is wrong or missing the word Bearer in the header. A 404 usually means the URL is missing /v1 or has an extra path.
SillyTavern
SillyTavern is a front end for roleplay and character chat, and it lets you add an OpenAI-compatible endpoint. The menu labels change between releases, so treat the steps as a map rather than exact wording.
- Open the API connection panel and choose Chat Completion as the API type.
- Select the Custom (OpenAI-compatible) source.
- Paste
https://api.nanobananaapis.com/v1as the endpoint URL. - Paste your key in the key field.
- Enter
uncensoredas the model name, or press the connect button and pick it from the list thatGET /v1/modelsreturns. - Press connect and send a test message.
Two tuning notes. SillyTavern sends long histories with character cards, so watch the 100,000-token context window, which is shared by prompt and reply. And if you use group chats that fire several requests at once, remember the limit of 8 concurrent requests on a full key (2 on a trial key). Roleplay and companion setups are for adults; the model will not produce sexual content involving minors under any prompt.
LangChain
In Python, the langchain-openai package provides ChatOpenAI, which accepts a custom base URL. Install it with pip install langchain-openai.
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://api.nanobananaapis.com/v1",
api_key=os.environ["NANOBANANA_KEY"],
model="uncensored",
temperature=0.7,
)
print(llm.invoke("Give me three names for a fictional smuggler ship.").content)
Chains, prompt templates and output parsers work the same way afterwards, since they only care about the chat interface. Tool calling goes through the standard path, so llm.bind_tools([...]) sends tools in the request. Test a single tool call before you build an agent around it, and cap agent parallelism at 8. A graph that fans out into twenty branches will hit the concurrency error.
The JavaScript package @langchain/openai takes the same idea through a configuration: { baseURL } option on ChatOpenAI.
Cursor and other editors
Cursor, like several other coding editors, has a settings area for models where you can supply your own OpenAI API key and override the base URL. Roughly: open the model settings, enable the custom OpenAI key option, set the override base URL to https://api.nanobananaapis.com/v1, paste your key, and add uncensored as a custom model name.
Be realistic about what this gives you. Editors build some features, such as inline completion, around their own backends and specific model names, so a custom endpoint may only apply to chat or a subset of commands. The exact options change between versions, so check the editor's current documentation. If a feature requires something this API does not offer, like embeddings or image input, it will not work through this endpoint.
The same pattern applies to other OpenAI-compatible clients such as Open WebUI, Continue and similar chat front ends: find the field for a custom OpenAI endpoint, enter the three values, and test.
Plain SDKs and environment variables
If you write your own code, the official SDKs read standard environment variables, which lets you switch endpoints without touching source files. In the Python and Node SDKs, setting OPENAI_BASE_URL and OPENAI_API_KEY is enough.
export OPENAI_BASE_URL="https://api.nanobananaapis.com/v1"
export OPENAI_API_KEY="YOUR_API_KEY"
python app.py # app.py calls client.chat.completions.create(model="uncensored", ...)
An explicit client in Node looks like this:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.nanobananaapis.com/v1",
apiKey: process.env.NANOBANANA_KEY,
});
const stream = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a short product description for a paper lantern." }],
stream: true,
});
for await (const part of stream) {
process.stdout.write(part.choices[0]?.delta?.content ?? "");
}
Streaming arrives over SSE with usage reported at the end. Full parameter details are on the docs page, and the article on prompt generation shows how to connect a text step to an image pipeline.
Fixing the common failures
| Symptom | Likely cause | Fix |
|---|---|---|
| 401 Unauthorized | Wrong key, or header missing Bearer | Recopy the key and test with curl |
| 404 Not Found | Base URL without /v1, or doubled path | Use exactly https://api.nanobananaapis.com/v1 |
| Model not found | Tool defaults to a vendor model name | Set the model to uncensored |
429 with rate_limited | Over 300 requests per minute (60 on trial) | Slow down and retry |
429 with concurrency | More than 8 requests at once (2 on trial) | Lower parallelism |
| 429 with Retry-After: 5 | Temporary overload | Wait five seconds and retry |
| Request too large | Body above 8 MB | Trim attachments or history |
Keep in mind that a streamed request holds its concurrency slot until the stream ends, so an editor that abandons streams can look like it is hitting the limit when it is not busy. Log the X-Request-Id header from failing calls; it is the first thing support will ask for.
On cost, a typical chat message of 2,000 tokens in and 500 out costs $0.00055 at $0.15 and $0.50 per 1M tokens, and failed requests are not charged. The pricing page covers top-ups from $20 to $500 and the bonus tiers.
Keys, safety and who sees what
Each integration stores your key somewhere, and some store it better than others. In a desktop front end the key sits in a local settings file. In a browser-based tool it may be saved in the browser. In an editor it lives in the app configuration. Know which one you are using before you share a screen, commit a dotfile or hand a laptop to someone else.
A few rules keep this manageable. Use one key per tool where you can, so you can replace a single one without breaking the rest. Never paste a key into a public issue tracker when asking for help; share the request ID instead. If a key leaks, replace it from the key page and update your tools. Prompts sent through the API are not used for training, and the privacy page describes the rest of the data handling.
If you host a front end for other people, do not ship your key to the browser. Put a small server between your users and the API, add your own limits there, and keep the key on the server. Your users then share your 8 concurrent requests, so plan how many people can chat at once.
Which tool fits which job
Because the integration is the same everywhere, the choice of tool comes down to what you are making.
- SillyTavern or a similar chat front end suits character chat, fiction and roleplay for adults, where you want a polished interface and character cards without writing code.
- LangChain suits pipelines in code: loaders, prompt templates, parsers and multi-step chains. It adds structure at the cost of one more dependency.
- A plain SDK call suits small scripts and services. If your task is one prompt in and one answer out, the OpenAI package alone is less to maintain than a framework.
- An editor like Cursor suits chat about code. Check which of its features accept a custom endpoint before you rely on it.
Start with the plain curl test, then the SDK, then add a framework only when you feel the need. Moving later is easy, since the three values never change. For a first request and the full parameter list, read the docs.
