Built from the official docs: openrouter.ai · Gemini 4 Neon - API Pricing & Benchmarks · Getting started | Gemini API | Google AI for Developers · checked 27 November 2026
Through OpenRouter
Get an OpenRouter API key
Sign up at openrouter.ai and create an API key in your dashboard. You will pass it as a Bearer token on every request.
Call the model with the REST API
Send a POST request to the OpenRouter responses endpoint. Set the model slug to google/gemini-4-neon and put your key in the Authorization header. The optional HTTP-Referer and X-OpenRouter-Title headers only affect leaderboard attribution.
curl https://openrouter.ai/api/v1/responses \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <OPENROUTER_API_KEY>" \ -d '{ "model": "google/gemini-4-neon", "input": "What is the meaning of life?" }'Or install the client SDK
Install the OpenRouter SDK for Python or JavaScript if you prefer typed calls over raw HTTP.
pip install openrouterSend a request from Python
Read your key from the environment and call client.responses.send with the model slug google/gemini-4-neon.
from openrouter import OpenRouter import os with OpenRouter(api_key=os.getenv("OPENROUTER_API_KEY")) as client: response = client.responses.send( model="google/gemini-4-neon", input="What is the meaning of life?", ) if response.status != "completed": message = response.error.message if response.error else f"Response ended as {response.status}" raise RuntimeError(message) message = next(item for item in response.output if item.type == "message") print(next(part.text for part in message.content if part.type == "output_text"))Or reuse the OpenAI SDK
If you already have OpenAI SDK code, point its base URL at OpenRouter and use your OpenRouter key; then set the model to google/gemini-4-neon.
from openai import OpenAI client = OpenAI( base_url="https://openrouter.ai/api/v1", api_key="<OPENROUTER_API_KEY>", ) response = client.responses.create( model="google/gemini-4-neon", input="What is the meaning of life?" ) print(response.output_text)
Direct from Google
Get a Gemini API key
Google AI Studio creates a project and API key for new users; copy it from the AI Studio API keys page, or click Create API key to make a new one.
Set the key as an environment variable
Export your key so the SDK and REST calls can read it.
export GEMINI_API_KEY="<YOUR_API_KEY>"Install the SDK
Install the Google Gen AI SDK for Python (use npm install @google/genai for JavaScript).
pip install -U google-genaiMake your first call
Initialize the client and create an interaction. The quickstart's swappable example uses the model id gemini-3.8-flash; substitute the Gemini 4 Neon model id for your account, since this page does not publish a specific Gemini-4-Neon id.
from google import genai client = genai.Client() interaction = client.interactions.create( model="<gemini-4-neon-model-id>", input="Explain how AI works in a few words" ) print(interaction.output_text)Or call the REST endpoint
Post to the Gemini interactions endpoint with your key in the x-goog-api-key header.
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \ -H "x-goog-api-key: $GEMINI_API_KEY" \ -H 'Content-Type: application/json' \ -d '{ "model": "<gemini-4-neon-model-id>", "input": "Explain how AI works in a few words" }'
Check it worked
You get a completed response whose output text answers your prompt. On OpenRouter the JSON has "status": "completed" with an output message containing output_text; on the Gemini API the response has "status": "completed" with a model_output text step (or interaction.output_text from the SDK).