Google Gemini API Tester
Build, run and copy Google Gemini generateContent API requests as cURL, Python and JavaScript.
Building the request and the cURL, Python and JavaScript code happens entirely in your browser. When you press Run, your Gemini API key and prompt are sent directly from your browser to Google (generativelanguage.googleapis.com), not to ArrayKit. The key is kept in browser memory on this device only and is never stored or sent to ArrayKit. Because Gemini puts the key in the URL query string it appears in the copied snippets - avoid using production keys on shared machines and never paste the key anywhere public.
Try the OpenAI API Tester
About Google Gemini API Tester
The Gemini API tester lets you build, run and copy Google Gemini generateContent requests without leaving your browser. Paste your Gemini API key, pick a model like gemini-1.5-flash, gemini-1.5-pro or gemini-2.0-flash, type a prompt, and the tool assembles the POST to generativelanguage.googleapis.com with the correct contents/parts JSON body and the key in the query string. Press Run to send the call and inspect the raw response, or copy ready-to-use cURL, Python and JavaScript snippets to drop into your own code. It is built for developers, prompt engineers and anyone evaluating Gemini who wants a fast, no-fuss way to confirm a key works, compare models, and grab boilerplate. The request and code are generated locally; running sends your key and prompt straight to Google.
Features
- Builds Google Gemini generateContent POST requests to the v1beta endpoint with the key in the query string
- Model picker with gemini-1.5-flash, gemini-1.5-pro and gemini-2.0-flash suggestions
- Generates correct contents and parts JSON body from your prompt automatically
- One-click copy of equivalent cURL, Python and JavaScript code
- Run button sends the call live and shows the raw JSON response or error
- Show/Hide toggle for the API key so it is not visible by default
- API key kept in browser memory only - never stored or sent to ArrayKit
- Direct link to Google AI Studio to create a Gemini API key
How to use the Google Gemini API Tester
- Paste your Gemini API key (starts with AIza) into the key field
- Pick a model such as gemini-1.5-flash or enter your own
- Type your prompt in the Prompt box
- Press Run to send the request and read the response, or switch the code tab and copy the cURL, Python or JavaScript
- If the browser blocks the call, copy the cURL and run it from a terminal
Example
Input
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=YOUR_GEMINI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents":[{"parts":[{"text":"Write a haiku about TypeScript."}]}]}'
Output
{
"candidates": [
{ "content": { "parts": [{ "text": "Types guard the morning..." }], "role": "model" } }
]
}
A minimal Gemini generateContent request and its response shape.
Common errors & troubleshooting
- The browser blocks Run with a CORS or network error. — Browsers cannot always call the Gemini endpoint directly. Copy the generated cURL or Python and run it from a terminal or your server instead.
- 400 API key not valid, or PERMISSION_DENIED. — Check the key from Google AI Studio is pasted correctly and the Generative Language API is enabled for that project.
- 404 model not found. — Use a valid model id such as gemini-1.5-flash, gemini-1.5-pro or gemini-2.0-flash; older or region-restricted names may 404.
- 429 RESOURCE_EXHAUSTED / quota exceeded. — You have hit a rate or quota limit. Wait and retry, or raise quota in Google Cloud for your project.
- Key visible in the copied snippet. — The Gemini key lives in the URL query string, so it appears in the cURL. Never commit it or paste it anywhere public; use an env var in real code.
Frequently asked questions
- What is the Gemini API tester?
- It is an ArrayKit tool that builds Google Gemini generateContent requests from a key, model and prompt, lets you run them, and copies the equivalent cURL, Python and JavaScript so you can test the API quickly.
- Does my Gemini API key get sent to ArrayKit?
- No. The request and code are built locally in your browser. When you press Run, your key and prompt go directly from your browser to Google's generativelanguage.googleapis.com endpoint - never to ArrayKit. The key is held in browser memory only and is never stored.
- Why does Run fail with a CORS error when the cURL works?
- Google may block direct browser-origin calls to the Gemini API. The generated cURL or Python runs from a terminal or server where CORS does not apply, so use that to confirm the call.
- Which Gemini models can I test?
- The model field suggests gemini-1.5-flash, gemini-1.5-pro and gemini-2.0-flash, and you can type any other model id your key has access to.
- Where is the API key placed in a Gemini request?
- Gemini takes the key as a ?key= query-string parameter on the v1beta generateContent URL, not in an Authorization header, so it appears in the copied URL and cURL.
- Is it safe to use my production key here?
- Avoid production keys on shared or public machines. The key stays in this device's browser memory, but it is included in the copied snippets, so prefer a restricted or test key and rotate it if exposed.
Related tools
- OpenAI API Tester — Build, run and copy OpenAI Chat Completions API requests as cURL, Python and JavaScript.
- Anthropic Claude API Tester — Build, run and copy Anthropic Claude Messages API requests as cURL, Python and JavaScript.
- Replicate API Tester — Build, run and copy Replicate prediction API requests as cURL, Python and JavaScript.
- Hugging Face API Tester — Build, run and copy Hugging Face Inference API requests as cURL, Python and JavaScript.
- API Request Client — Send HTTP requests, build headers and params, inspect responses — your last 25 requests are saved locally.
- cURL to Fetch — Convert a curl command to a JavaScript fetch() call.
- URL Parser — Break a URL into its parts and list query parameters.
- JSON Formatter — Beautify, minify and validate JSON with error locations.
All ArrayKit tools