gemini-4-neon
Use Gemini 4 Neon with native Google GenerateContent requests, streaming, four thinking levels, JSON schemas, tool calls, and explicit continuation on reAPI.
Use gemini-4-neon with reAPI's native Google GenerateContent endpoints; see the model page for current availability and pricing.
Quick example
These examples make one non-streaming request without automatic retries or continuation. Your reAPI key belongs in x-goog-api-key; a Google account key is not required. Python uses the standard library. The JavaScript example uses @google/genai 2.29.1 or higher with explicit retry and continuation controls.
curl https://reapi.ai/api/v1beta/models/gemini-4-neon:generateContent \
-H "x-goog-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{"role":"user","parts":[{"text":"Audit this retry queue for race conditions and outline a minimal fix."}]}],
"generationConfig": {
"maxOutputTokens": 4096,
"thinkingConfig": {"thinkingLevel":"high"}
}
}'import json
from urllib.request import Request, urlopen
body = {
"contents": [{"role": "user", "parts": [{"text": "Audit this retry queue for race conditions and outline a minimal fix."}]}],
"generationConfig": {
"maxOutputTokens": 4096,
"thinkingConfig": {"thinkingLevel": "high"},
},
}
request = Request(
"https://reapi.ai/api/v1beta/models/gemini-4-neon:generateContent",
data=json.dumps(body).encode("utf-8"),
headers={"x-goog-api-key": "YOUR_API_KEY", "Content-Type": "application/json"},
method="POST",
)
with urlopen(request, timeout=120) as response:
result = json.load(response)
print(json.dumps(result, indent=2))import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({
apiKey: "YOUR_API_KEY",
httpOptions: {
baseUrl: "https://reapi.ai/api",
apiVersion: "v1beta",
retryOptions: { attempts: 1 },
},
});
const response = await ai.models.generateContent({
model: "gemini-4-neon",
contents: "Audit this retry queue for race conditions and outline a minimal fix.",
config: {
maxOutputTokens: 4096,
thinkingConfig: { thinkingLevel: "high" },
automaticContinuation: false,
},
});
console.log(response.text);package main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
body := []byte(`{
"contents":[{"role":"user","parts":[{"text":"Audit this retry queue for race conditions and outline a minimal fix."}]}],
"generationConfig":{"maxOutputTokens":4096,"thinkingConfig":{"thinkingLevel":"high"}}
}`)
req, err := http.NewRequest("POST",
"https://reapi.ai/api/v1beta/models/gemini-4-neon:generateContent",
bytes.NewReader(body))
if err != nil { panic(err) }
req.Header.Set("x-goog-api-key", "YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, err := io.ReadAll(resp.Body)
if err != nil { panic(err) }
fmt.Println(resp.Status, string(out))
}Endpoints and authentication
| Method | URL | Response |
|---|---|---|
POST | https://reapi.ai/api/v1beta/models/gemini-4-neon:generateContent | Native JSON |
POST | https://reapi.ai/api/v1beta/models/gemini-4-neon:streamGenerateContent?alt=sse | Native SSE |
Send Content-Type: application/json and x-goog-api-key: YOUR_API_KEY. Authorization: Bearer YOUR_API_KEY and the Google-compatible ?key=YOUR_API_KEY query parameter are also accepted. Prefer the header examples. An explicitly supplied Google key takes precedence over bearer or browser-session credentials. Create your key in API Keys.
The JavaScript Google SDK base URL is https://reapi.ai/api, with apiVersion: "v1beta". The SDK appends /v1beta/models/gemini-4-neon:generateContent, or its streaming equivalent. Do not put /v1beta in both the base URL and API version. Direct HTTP clients use the full endpoint shown above.
Select streaming by endpoint, not a stream body field. generateContent returns JSON; streamGenerateContent?alt=sse returns text/event-stream. There is no asynchronous task ID or task polling. This integration exposes these generation methods, not Google's Files, cache-management, Interactions, or token-counting APIs.
Request parameters
The native JSON body is forwarded unchanged, including unknown fields and nested schemas. This inventory describes Google's request format; it is not a field allowlist. The model service determines parameter acceptance and behavior. Authentication, billing admission, request size, and the platform media policy remain separate checks.
The model is selected in the URL. Do not replace contents with OpenAI messages or put reasoning_effort in a native request.
| Field | Type | Required / default | Meaning |
|---|---|---|---|
contents | Content array | Required | Conversation history plus the current input; each content has role (user or model) and parts |
tools | Tool array | Optional; omitted | Native function declarations and supported built-in tools |
toolConfig | object | Optional; omitted | Native function-calling and other tool configuration |
safetySettings | array | Optional; model defaults | Per-category thresholds; Google permits at most one setting per category |
continuationToken | string | Optional; omitted | Opaque checkpoint token returned by a candidate; resend the original contents unchanged when continuing |
labels | string-valued object | Optional; omitted | Request metadata; Google specifies lowercase letters, digits, underscores, and dashes, at most 63 characters per key/value, with keys starting with a letter |
systemInstruction | Content object | Optional; omitted | Top-level text instructions, such as {"parts":[{"text":"Be concise."}]} |
generationConfig | object | Optional; model defaults | Output budget, thinking level, stop sequences, schemas, and other generation settings |
serviceTier | string enum | Optional; standard | unspecified, standard, flex, priority; availability depends on the model service |
store | boolean | Optional; omitted | Google request-logging control; reAPI does not add a default |
For media, use native fileData parts with a public HTTP(S) fileUri and the actual mimeType. inlineData, base64 media, and data: media URIs are not accepted. Opaque thought signatures and continuation tokens are protocol state, not media inputs; preserve them verbatim. Google documents text, image, video, audio, and PDF inputs for Neon and text output. A format's presence in the generic API does not guarantee model-specific availability.
generationConfig
All fields below are optional. Unless stated, omission leaves the model default in effect; reAPI does not inject sampling defaults or rewrite schemas.
| Field | Type | Documented behavior |
|---|---|---|
maxOutputTokens | integer | Thinking plus output budget; REST defaults and per-request caps are 65,536 for both JSON and SSE. Larger budgets can require continuation. Input, thinking, and output share 1,048,576 tokens |
thinkingConfig | object | thinkingLevel: low, medium, high (Neon default), xhigh; includeThoughts requests available thought summaries. Thinking cannot be disabled, and native minimal is rejected. thinkingBudget is deprecated and cannot be combined with thinkingLevel |
stopSequences | string array | Up to five sequences; the matched sequence is excluded from output |
responseMimeType | string | text/plain by default; application/json and text/x.enum are documented alternatives |
responseJsonSchema | JSON value | JSON Schema output constraint; forward the complete schema, with support determined by Google |
responseSchema | object | Legacy output schema, deprecated in the current reference; do not combine with responseJsonSchema |
responseFormat | object | Native REST JSON output uses responseFormat.text with mimeType: "APPLICATION_JSON" and a schema; model support is determined upstream |
responseModalities | string array | Omitted or empty requests text; Neon is a text-output model |
seed | integer | Optional decoding seed; omission leaves selection to the service |
presencePenalty, frequencyPenalty | number | Native repetition settings; model behavior varies |
responseLogprobs | boolean | Requests candidate log probabilities where supported |
logprobs | integer | 0–20 alternatives in the generic reference; requires responseLogprobs |
mediaResolution | string enum | MEDIA_RESOLUTION_UNSPECIFIED, MEDIA_RESOLUTION_LOW, MEDIA_RESOLUTION_MEDIUM, MEDIA_RESOLUTION_HIGH; support depends on media and model |
enableEnhancedCivicAnswers, enableAffectiveDialog | boolean | Generic Google options; model availability varies |
translationConfig, audioTranscriptionConfig | object | Generic task configurations; model availability varies |
The controls follow the recorded Neon request inventory. Google's migration guide says to remove temperature, topP, topK, and candidateCount; in-range custom sampling values are ignored and out-of-range values return an upstream 400 error. Explicit caching (cachedContent) is unsupported. Additional fields still pass through unchanged; omitting them from the UI inventory does not add an API rejection rule. The Google GenerateContent reference defines nested content, tool, safety, and configuration objects.
Structured output
This native configuration requests an object matching a JSON Schema:
{
"generationConfig": {
"responseMimeType": "application/json",
"responseJsonSchema": {
"type": "object",
"properties": {"answer": {"type": "string"}},
"required": ["answer"],
"additionalProperties": false
}
}
}OpenAI-compatible requests
Existing OpenAI clients can use POST https://reapi.ai/api/v1/chat/completions, an OpenAI SDK base URL of https://reapi.ai/api/v1, and bearer authentication. That body uses model, messages, stream, and OpenAI parameter names. Keep it separate from the native body above.
Google documents the compatibility mapping reasoning_effort: minimal → low, low → low, medium → medium, high → high, and xhigh → xhigh for gemini-4-neon and gemini-4-hydrogen. Prefer the native generationConfig.thinkingConfig format when working directly with Gemini-specific settings and signed parts. Acceptance of a parameter does not prove its effect. See Google OpenAI compatibility.
Groups
See the model page’s live group prices. Copy the complete model ID shown for the group you want and use it in the model segment of the native Gemini URL, or in the model field for OpenAI-compatible calls. The same reAPI key works across available groups; no separate group key is needed.
Keep the bare gemini-4-neon model ID to use its configured default group when enabled, or pass gemini-4-neon:GROUP_ID to target a specific discovered group. For programmatic discovery and compatibility details, see LLM groups.
Pricing dimensions
Current rates are read from the configured price group and displayed on the model page. Input, output (including thinking), and cached input carry separate rates across the full 1M context window. The final charge follows the selected group's settled request amount, including any applicable tool fees. Explicit caching is not supported on Neon; implicit caching runs automatically on prompts of at least 4,096 tokens, and a repeated prompt is a cache hit only when usage reports cached tokens.
Each continuation is a separate HTTP request with its own usage and charge. reAPI performs one generation attempt per request, with no automatic retries or continuation loop. Your application's SDK can otherwise issue additional requests, which is why the examples disable both behaviors.
Bill formula
For ordinary token usage, the estimate is (input_tokens − cached_tokens) × input_rate + cached_tokens × cache_read_rate + output_tokens × output_rate. Thinking tokens count as output. Any applicable tool charges also apply; the final settled request amount is authoritative. reAPI does not multiply an already group-adjusted amount by the group ratio again.
The final USD amount is retained in micro-units: micro_units = ceil(billed_usd × 1,000,000), then credits = micro_units / 1,000. One credit equals $0.001. Streamed usage is cumulative and settles once after complete delivery. Failed delivery, cancellation, incomplete streams, or missing trusted billing evidence follow the no-charge path.
Responses, tools and continuation
| Field | Meaning |
|---|---|
candidates[] | Native response candidates; inspect each candidate's content, finishReason, and optional continuationToken |
content.parts[] | Text, thought summaries, signed parts, function calls, and other native output parts |
usageMetadata | Prompt, candidate, thinking, cached-content, and applicable tool-use token counters |
promptFeedback | Prompt blocking or safety feedback when returned |
groundingMetadata, citationMetadata | Candidate-level grounding or citation data when returned |
modelVersion, responseId | Model and response identifiers when supplied |
Text comes from candidate parts with text; parts marked thought: true are thought summaries. Preserve the complete model content for later turns, including thoughtSignature, part ordering, and functionCall objects. Do not reconstruct a signed turn from displayed text alone.
Your application executes client functions and sends functionResponse parts in a subsequent user content. reAPI does not execute those functions. When supplying Python callables to the Google SDK, disable automatic function calling if your application must control each tool round trip explicitly.
For streaming, change the curl URL to :streamGenerateContent?alt=sse and add --no-buffer. Each SSE data: frame contains a native JSON response fragment. The stream ends at EOF, with no OpenAI [DONE] sentinel. Inspect in-stream error frames and finishReason before treating partial text as a completed generation.
CONTINUATION means the per-request 65,536-token hop cap was reached before generation finished. The candidate supplies an opaque continuationToken; a hop spent on thinking may return empty visible text. To continue, send the original contents unchanged with that token. If resuming after MAX_TOKENS, raise maxOutputTokens. Keep the token intact; do not generate or decode it yourself. See Google's long-decode guide.
Errors
Native errors use Google's shape, with an HTTP status code and status name:
{
"error": {
"code": 400,
"message": "Request body must be a JSON object.",
"status": "INVALID_ARGUMENT"
}
}The response includes a request-id header for support. Native model error details are preserved where returned. OpenAI-compatible errors retain that endpoint's separate format.
| HTTP status | Native status | Meaning |
|---|---|---|
| 400 | INVALID_ARGUMENT | Invalid JSON/request or a model-rejected parameter combination |
| 401 | UNAUTHENTICATED | Missing or invalid reAPI key |
| 402 | FAILED_PRECONDITION | Insufficient balance for admission |
| 403 | PERMISSION_DENIED | Access denied |
| 404 | NOT_FOUND | Unknown model or method |
| 413 | INVALID_ARGUMENT | Request body exceeds 32 MB |
| 429 | RESOURCE_EXHAUSTED | Rate or concurrency limit |
| 502 | INTERNAL | Invalid response or incomplete delivery |
| 503 | UNAVAILABLE | Service or pricing unavailable |
| 504 | DEADLINE_EXCEEDED | Request deadline exceeded |
An error can arrive inside an already-open SSE stream. Handle it before treating the result as complete. See the platform error catalog for other reAPI surfaces.
Tips
- Start with
high(Neon's default) for complex coding, agentic tool use, and analytical tasks, and reservexhighfor problems wherehighfalls short. - Leave
maxOutputTokensomitted (or set it to at least65536) rather than carrying over a low 8,192 cap, since thinking tokens share that budget. - Keep original signed parts across tool turns and store the original request separately if you implement explicit
continuationTokenloops. - Use native JSON for Gemini-specific tools and generation settings. Do not mix OpenAI field names into a native request.
- Use public HTTP(S) URLs and accurate MIME types for media inputs; this endpoint does not upload files to Google for you.
- Inspect usage and finish reasons. HTTP 200 alone does not verify grounding, caching, schema adherence, or a particular parameter's effect.
Observed behavior
Live service checks on November 20, 2026 verified native JSON (:generateContent), native SSE (:streamGenerateContent?alt=sse, ending cleanly at EOF without [DONE]), thought summaries (includeThoughts: true with thought: true and thoughtSignature), a requested function call (lookup_order with functionCall + thoughtSignature), OpenAI-compatible /v1/chat/completions (high, xhigh, and minimal), and receipt-backed settlement (one upstream request per call). Native xhigh and OpenAI reasoning_effort: "xhigh" / "minimal" were accepted with HTTP 200; acceptance alone does not establish reasoning quality. On the tested channel, responseMimeType: "application/json" with responseSchema returned strict valid JSON, whereas responseJsonSchema and responseFormat.text returned HTTP 200 without enforcing JSON output. Forward the documented schema field you need and validate the returned content in your application.
Related
- Gemini 4 Neon model page
- Gemini 4 Hydrogen
- Gemini 4 Carbon
- LLM groups
- Authentication
- Machine-readable OpenAPI
Official model evidence reviewed 2026-11-20: GenerateContent, Neon model, What's new in Neon, thinking, long decode, OpenAI compatibility.