Gemini 4 Neon API setup guide
Call gemini-4-neon through TokenRex's OpenAI-compatible chat endpoint. This guide uses a small low-latency multimodal agents example and explains what to verify before production.
gemini-4-neon1. Prepare your account and private key
Create a TokenRex account, verify it, fund your wallet and create an API key with permission for gemini-4-neon. Store the key privately as TOKENREX_API_KEY on the server running your application. Never embed it in a public website, repository or browser script.
Python: install the official openai package. Node.js: add the openai package and run the example from a server-side module. Shell examples assume the private environment variable is already set.
2. Use the correct address and exact ID
- OpenAI-compatible SDK base URL
- https://tokenrex.ai/api/public/v1
- HTTP request
- POST https://tokenrex.ai/api/public/v1/chat/completions
- Model ID
- gemini-4-neon
Do not append /v1 twice. The short model ID selects the exact catalog row; naming a provider is not a substitute for choosing a model.
3. Send a small text request
The prompt below exercises low-latency multimodal agents. Begin with model and messages only. Add streaming after the basic request succeeds; these Gemini 4 models support function tools and strict JSON schema, but TokenRex does not expose web search, penalties, Responses, Fast serving or media generation for them. Setting reasoning effort to none may still consume reasoning tokens.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["TOKENREX_API_KEY"],
base_url="https://tokenrex.ai/api/public/v1",
)
response = client.chat.completions.create(
model="gemini-4-neon",
messages=[{"role":"user","content":"Plan a three-step support workflow with explicit function-tool inputs and a final customer-safe answer."}],
)
print(response.choices[0].message.content)
print(response.usage)Gemini compatibility boundary
These examples call Gemini through OpenAI-compatible Chat Completions. They do not use Google's native generateContent format. Native Google tools, file uploads or media controls must not be assumed to work through this endpoint; consult the model's documented support.
4. Verify the response and recorded usage
- Confirm a successful response includes a usable answer; HTTP 200 alone is not a quality or compatibility test.
- Check the returned model identifier and usage counts, then confirm the request appears in your account's recorded usage.
- Try representative inputs, validate the output in your own code and check costs before increasing traffic.
- For tools, authorize and execute functions in your application, validate arguments and send the result back. TokenRex does not execute customer tools for you.
Troubleshooting
- 401 or 403
- Check that the key is active, is a TokenRex key and permits this exact model. Do not print it while debugging.
- 402
- Check wallet funding; changing the display currency does not add balance.
- 404 or model unavailable
- Check the enabled catalog and URL. Avoid duplicate /v1 segments and wrong model spelling.
- 429 or a temporary service error
- Respect the returned wait period and use bounded retries. A retry is a new attempt; do not silently switch models or replay consequential tools.
Model-specific checks
Neon is text-output only and has no TokenRex Fast version or built-in web search. Your application authorizes and executes every function tool.
- Context capacity
- 1,048,576 tokens
- Maximum output
- 65,536 tokens
- Current usage price
- $2.10 in / $10.50 out per 1M tokens
Limits are provider-published where a source exists, not independently tested TokenRex request limits. Exact-version benchmarks remain on the model page; scores from another variant are not copied here.
Sources and verification
TokenRex's live catalog determines availability and charges. Provider documents describe upstream behavior; they do not prove that every native feature is exposed here. These examples are not a claim of a completed live API test.
- TokenRex enabled catalog and prices
- TokenRex endpoint and billing documentation
- Official OpenAI Python SDK: custom client configuration
- Official OpenAI Node SDK: custom client configuration
- TokenRex Gemini 4 integration contract and supplied BlinkyOne test notes · reviewed 2026-11-28
- Google DeepMind · Gemini 4 Neon model-card evaluation · reviewed 2026-11-28
- Artificial Analysis · independent release comparison · reviewed 2026-11-28
- Plotly · Gemini 4 analytics exam comparison · reviewed 2026-11-28