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 天免费 · 无需信用卡 · EU 托管

问 Google 任何事

通过 AnythingMCP 对 Google Gemini API 试一个真实提示 — Claude 调用工具并返回答案。在你的消息上按 Enter 即可在 Cloud 安装。

在 Cloud 上安装 Google
Google Gemini API · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

2 分钟设置

  1. 1在 cloud.anythingmcp.com 开始免费试用。
  2. 2在连接器商店点击 Google Gemini API。提示时粘贴凭据。
  3. 3生成 MCP API 密钥,将 AI 客户端指向生成的 MCP URL。
立即安装 Google Gemini API

Google 指南

面向主流 AI 客户端的逐步设置。

配置 Google Gemini API

直接来自连接器定义:在哪里获取凭据、需要哪些权限,以及该适配器调用的是哪个 API。 由连接器作者以英文提供。

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.

你的 AI 距离 Google Gemini API 仅两次点击。

安装连接器、粘贴凭据、向 AI 提问。7 天免费,无需信用卡。