Google Gemini API

Google Gemini API

Let your AI use Google Gemini with your own API key: ask Gemini models questions, analyse images and PDFs from a link, count tokens, create embeddings, and generate or edit pictures with Nano Banana that appear right in the chat.

7-day free trial · No credit card · EU-hosted

Ask Google anything

Try a real prompt against Google Gemini API via AnythingMCP — Claude calls the tools, returns the answer. Press Enter on your own message to install on Cloud.

Install Google on Cloud
Google Gemini API · live via MCP
Share
Opus 4.7

Claude is AI and can make mistakes. Please double-check responses.

Setup in 2 minutes

  1. 1Start a free trial on cloud.anythingmcp.com.
  2. 2Click Google Gemini API in the connector store. Paste credentials when prompted.
  3. 3Mint an MCP API key and point your AI client at the generated MCP URL.
Install Google Gemini API now

Guides for Google

Step-by-step setup for the most popular AI clients.

Setting up Google Gemini API

From the connector definition itself: where to find the credentials, what they need to be allowed to do, and which API this adapter talks to.

Google Gemini API

This connector calls the Gemini API (Generative Language API, https://generativelanguage.googleapis.com/v1beta) with the user's own API key from Google AI Studio: text answers from Gemini models, questions about images, PDFs and other files given by link, token counts, text embeddings, image generation and editing (Nano Banana), the model list and the Files API.

Every call except the model list, the Files API and token counting is billed to the user's key (or counts against its free tier). Prefer the cheap defaults unless the user asks for more.

Setup (about 2 minutes)

  1. Open Google AI Studio at https://aistudio.google.com/apikey and sign in with a Google account.
  2. Click Create API key, pick or create a Google Cloud project, and copy the key.
  3. Paste it into GEMINI_API_KEY and install the connector. It is sent in the x-goog-api-key header and only to Google.
  4. Free tier: text and embedding models can be used free of charge within per-minute and per-day limits, and Google may use free-tier prompts to improve its products. Image models have no free tier: enable billing for the project in AI Studio (Get API key, then Set up billing) to generate images, and for higher limits.

Defaults (cheap and fast)

  • Text: gemini-3.1-flash-lite (stable; about $0.25 per million input tokens and $1.50 per million output tokens on the paid tier). For harder tasks pass gemini-3.5-flash-lite, gemini-3.8-flash or gemini-3.1-pro-preview.
  • Images: gemini-3.1-flash-lite-image (about $0.034 per 1K picture). gemini-nano-banana-2.1 and gemini-3.1-flash-image add 2K and 4K, gemini-3-pro-image is the most capable (about $0.13 per picture).
  • Embeddings: gemini-embedding-001 with 768 dimensions.
  • Model codes change often: gemini_list_models shows what the key can use. Pass codes without the models/ prefix.

Tools

  • gemini_generate_text: one prompt, one answer. Optional system instruction, answer length, temperature and JSON output (response_mime_type application/json plus response_json_schema).
  • gemini_generate_content: the full request, for conversations (a list of user and model turns), several files in one prompt, Google Search grounding (tools: [{"googleSearch": {}}]) and any generationConfig field.
  • gemini_analyze_file_url: a question about one file given by a public HTTPS link (images, PDF, text, CSV, video; up to 15 MB). Gemini fetches the link itself, so it must work without a login.
  • gemini_count_tokens: free token count of a text.
  • gemini_embed_text and gemini_batch_embed_texts: embedding vectors (up to 20 texts per batch call).
  • gemini_generate_image and gemini_edit_image: pictures returned as images in the chat. Each picture costs money: confirm with the user before every call. A client that cannot show images still gets the text part with the size and type of each picture. Pictures over 4 MB are not returned; ask for a smaller size.
  • gemini_list_models, gemini_get_model: what the key can use.
  • gemini_list_files, gemini_get_file, gemini_delete_file: the project's Files API (files expire after 48 hours; uploading is not part of this connector). gemini_delete_file is installed switched off.

Reading answers: text is the answer, finishReason says why it stopped: STOP is normal, MAX_TOKENS means it was cut (raise max_output_tokens, which includes thinking tokens on Gemini 3 models). A prompt or answer blocked by Google's safety filters (SAFETY, PROHIBITED_CONTENT, BLOCKLIST, SPII, RECITATION, IMAGE_SAFETY) comes back as an error: do not retry the same request. NO_IMAGE means the image model answered with text only; rephrase the prompt as a request for a picture.

Common errors

  • 400 API_KEY_INVALID: the key is wrong or was deleted. Create a new one in AI Studio.
  • 403 PERMISSION_DENIED: the key is restricted to other APIs (Google Cloud console, Credentials, API restrictions: allow the Generative Language API), the API is off in its project, or a file link is not public.
  • 404: the model code does not exist or does not support the method; check gemini_list_models.
  • 429 RESOURCE_EXHAUSTED: a per-minute or per-day limit of the free tier or the paid tier, or an image model without billing. Wait and retry once, or enable billing. Do not retry in a loop.
  • 400 FAILED_PRECONDITION: the free tier is not available in the user's region; enable billing.

Out of scope here: uploading files, the Live API (audio and video streaming), speech (TTS), video generation (Veo), context caching, batch jobs, tuned models and file search stores.

Your AI is two clicks away from Google Gemini API.

Install the connector, paste your credentials, ask your AI a question. 7-day free trial, no credit card.