Gemini API
by Google
Google AI models for text, files and media.
1. Price
“5,000 free search requests per month (shared across all Gemini 3 and newer models), then $14 per 1,000 requests”
Free tier: Free tier with rate limits on some models (not Gemini 4 Argon). As reported on the official pricing page, checked Oct 22, 2026.
ai.google.dev/gemini-api/docs/pricing2. Commercial use
“Use of Google AI Studio and Gemini API is for developers building with Google AI models for professional or business purposes, not for consumer use.”
Allowed for professional or business use by adults; not in apps aimed at under-18s, and apps for users in the EEA, Switzerland or the UK must use the paid tier.
aistudio.google.com/docs/terms3. Key & sign-up
“Set the environment variable GEMINI_API_KEY or GOOGLE_API_KEY. The Gemini API client libraries automatically detect and use these variables. If both are set, GOOGLE_API_KEY takes precedence.”
API key in the x-goog-api-key header (the official packages read it from the environment)
aistudio.google.com/docs/api-key4. Agent access
“The public Gemini Docs MCP server (https://gemini-api-docs-mcp.dev) gives your agent live access to the entire documentation site.”
Our agent check: 2 of 6 (Nov 13, 2026).
aistudio.google.com/docs/coding-agentsChecked against the maker's official pages, pricing on Oct 22, 2026. Tap a verdict to see its source.How we checkedReport an error
What Gemini API does
The Gemini API lets your app send a question, a document, a photo, a recording or a video to Google's Gemini models and get an answer back. It writes and summarizes text, reads files and media, can check facts with Google Search, and also makes images, video and music. There is a free tier with limits; paid use is billed by the amount of text processed.
- Gemini API is one of 41 APIs in the Model hosting and inference category on AgentGid.
- It is one of 13 that can be started for free.
- 6 of them ship an official MCP server; Gemini API does not.
- Its official SDK is the 2nd most downloaded in the category (72.1M a week).
What people build with it
Answers with fresh web facts
Let a help bot or research tool answer with current information from Google Search, and show the links it used.
Pull details out of PDFs
Upload contracts, invoices or reports and get back the facts you need, such as dates, names and totals.
Summaries of audio recordings
Turn a meeting recording or a podcast episode into a written transcript, a summary, or answers to your questions.
Find moments in videos
Ask what happens in a video and where, for example to tag clips in a video library or write short descriptions.
Filled forms from free text
Turn a customer's message or a pasted recipe into neat fields your app can save, such as name, items and time.
Product descriptions for a shop Idea
Draft short descriptions for each item in an online shop from a few notes, then edit them before publishing.
Gemini API popularity
SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026.
Pricing
Free tier with rate limits on some models (not Gemini 4 Argon)
No monthly plan
Paid tier billed per 1M tokens by model (prepaid or pay-as-you-go)
What one action costs
| Action | Price |
|---|---|
| 1M input tokens, Gemini 3.8 Flash (through December 31, 2026) | $0.75 |
| 1M output tokens, Gemini 3.8 Flash (through December 31, 2026) | $3.75 |
| 1M input tokens, Gemini 3.5 Flash-Lite (text, image, video, audio) | $0.30 |
| 1,000 Google Search grounding requests after 5,000 free a month (Gemini 3+) | $14 |
As reported on the official pricing page, checked Oct 22, 2026. Prices change: confirm before you buy. ai.google.dev/gemini-api/docs/pricing
Limits
Limits count per project (requests per minute, input tokens per minute, requests per day); daily limits reset at midnight Pacific time.
Exact limits per model and tier are shown only in Google AI Studio.
$10 of spend per rolling 10 minutes
100 concurrent batch requests, 2GB input file, 20GB file storage
From the official docs. aistudio.google.com/docs/rate-limits
Key and access
API key in the x-goog-api-key header (the official packages read it from the environment)
GEMINI_API_KEYNo
Steps only a person can do
- Sign in to Google AI Studio and copy or create a Gemini API key. Put it in .env as GEMINI_API_KEY (kept out of git); the official packages read it automatically.
- For production, for users in the EEA, Switzerland or the UK, or for Gemini 4 Argon, set up billing and prepay at least $5. No code change; the same key moves to paid limits.
- If AI Studio shows "Verification needed", verify the account with a phone or set up billing. Retry the request after the project status changes.
Commercial use and your data
It is a paid online service from Google with a free tier, not open source. It is meant for business use by adults, and Google does not claim ownership of what it generates. Apps for users in Europe or the UK must use the paid tier.
Allowed for professional or business use by adults; not in apps aimed at under-18s, and apps for users in the EEA, Switzerland or the UK must use the paid tier.
“Use of Google AI Studio and Gemini API is for developers building with Google AI models for professional or business purposes, not for consumer use.” source
Google does not claim ownership of generated content, but may generate similar content for others; you are responsible for how you use it.
“You're responsible for your use of generated content, and for the use of that content by anyone you share it with.” source
You may not use the service to build models that compete with Gemini, or extract its data or weights.
“You may not use the Services to develop models that compete with the Services (e.g., Gemini API or Google AI Studio).” source
Fine as business use; for medical advice or clinical practice it is not allowed.
“You may not use the Services in clinical practice, to provide medical advice, or in any manner that is overseen by or requires clearance or approval from a medical device regulatory agency.” source
“Google uses the content you submit to the Services and any generated responses to provide, improve, and develop Google products and services and machine learning technologies”
Paid tier prompts and answers are logged for a limited time to detect misuse; Google Search grounding data is kept 30 days.
“For Paid Services, Google logs prompts and responses for a limited period of time, solely for detecting and preventing violations of the Prohibited Use Policy” source
Only in listed countries; data may be stored or cached in any country where Google has facilities.
“This data may be stored transiently or cached in any country in which Google or its agents maintain facilities.” source
Errors to handle
The API key is missing, invalid, or expired.
Check the key in GEMINI_API_KEY; do not retry.
The prepaid credit balance is used up.
Top up credits or turn on auto-reload; do not retry until credits are added.
The key lacks permission, or the project is restricted, needs verification, or needs billing changes.
Check the project status in AI Studio (verification, billing, leaked key) and fix it there.
Too many requests or tokens per minute, or the daily quota is used up.
Retry with exponential backoff; for the daily quota wait for the reset or ask for an increase.
The service is temporarily overloaded or down.
Retry with exponential backoff.
Use it from an agent
2 of 6: llms.txt no, OpenAPI no, SDK yes, MCP no, status page no, AI assistants allowed yes
Checked Nov 13, 2026.
Gemini Docs MCP server (documentation search only; it does not call models)
claude mcp add --transport http geminiDocs https://gemini-api-docs-mcp.dev
npm install @google/genaipip install google-genaiInstructions in its docs to check first
“Building with an AI coding agent? Install the skill and then paste the prompt to get started with the Gemini API using Interactions:”
Ask the person first. The suggested command is npx skills add google-gemini/gemini-skills (an unpinned package) and it changes the agent's setup.
“curl -fsSL https://raw.githubusercontent.com/google-gemini/gemini-api-cli/main/scripts/install.sh | bash”
Never run it on your own; it pipes a script from the internet into the shell. Ask the person, and prefer the pinned google-genai package in the project.
“npx skills add google-gemini/gemini-skills --skill gemini-api-dev --global”
Ask the person first; it installs skills globally from an unpinned source.
Alternatives
Gemini API This page
Pick the OpenAI API when you want GPT models for text, vision, tool calling and agents, also priced per 1M tokens.
Pick Groq when you want fast answers from open models such as GPT-OSS and Llama.
Pick Mistral when you want Mistral's open-weight and commercial models from one provider.
Get started
Tell your AI assistant
“Add Gemini to my app with the google-genai package and the Interactions API: call it from the server with GEMINI_API_KEY from .env, use model gemini-3.8-flash, and never put the key in browser code.”
Get a Gemini API key in Google AI Studio (new users get a project and key automatically) and set it as an environment variable.
export GEMINI_API_KEY="YOUR_API_KEY"Install the official Google GenAI package for Python or JavaScript.
pip install -U google-genai npm install @google/genaiMake the first request with the Interactions API and print the answer.
from google import genai client = genai.Client() interaction = client.interactions.create( model="gemini-3.8-flash", input="Explain how AI works in a few words" ) print(interaction.output_text)
First request
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-H "Api-Revision: 2026-05-20" \
-d '{
"model": "gemini-3.8-flash",
"input": "Explain how AI works in a few words"
}'{
"id": "v1_ChdpQUFvYXI...",
"status": "completed",
"steps": [
{
"type": "model_output",
"content": [
{
"type": "text",
"text": "AI learns patterns from data, then uses those patterns to make predictions or decisions on new data."
}
]
}
],
"object": "interaction",
"model": "gemini-3.8-flash"
}Mistakes to avoid
Coding assistants learned older names; the docs warn they suggest deprecated models and packages.
A key in client code can be read and used by anyone, on your bill.
These models ignore the values, send deprecation warnings, and will return 400 errors in a future release.
Client errors mean a bad key, empty prepaid credit or bad syntax, and will fail again.
Version 3.0.0 requires Node.js 22.
Questions
Is there a free tier?
Yes. New accounts start on the free tier, which covers certain models up to their free limits. The top model, Gemini 4 Argon, is not included.
Does Google train on what I send?
On the free tier, yes, it may use your content to improve its products. On the paid tier it does not.
Can I put the key in my web page?
No. The docs say keys in web or mobile apps can be extracted; call Gemini from your own server instead.
Are my rate limits per key?
No, per project, so several keys in one project share the same limits. Daily limits reset at midnight Pacific time.