Integrate gemini-3.8-flash through gemini. Request examples, parameters, authentication and result handling.
/v1beta/models/{model}:generateContentMODELgemini-3.8-flashCode examples & responses
/v1beta/models/gemini-3.8-flash:generateContentcurl "https://newrouters.com/v1beta/models/gemini-3.8-flash:generateContent" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $API_KEY" \
--data '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Explain how an HTTP request works in three concise steps."
}
]
}
],
"generationConfig": {
"maxOutputTokens": 1024
}
}'const apiBaseUrl = "https://newrouters.com";
const apiKey = process.env.API_KEY;
if (!apiKey) throw new Error("Set API_KEY in your server environment");
const response = await fetch(apiBaseUrl + "/v1beta/models/gemini-3.8-flash:generateContent", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-goog-api-key": apiKey
},
body: JSON.stringify({
"contents": [
{
"role": "user",
"parts": [
{
"text": "Explain how an HTTP request works in three concise steps."
}
]
}
],
"generationConfig": {
"maxOutputTokens": 1024
}
})
});
const result = await response.json();
if (!response.ok) throw new Error(JSON.stringify(result));
console.log(result);import json
import os
from urllib.request import Request, urlopen
api_base_url = "https://newrouters.com"
api_key = os.environ["API_KEY"]
body = json.loads("{\"contents\":[{\"role\":\"user\",\"parts\":[{\"text\":\"Explain how an HTTP request works in three concise steps.\"}]}],\"generationConfig\":{\"maxOutputTokens\":1024}}")
request = Request(
api_base_url + "/v1beta/models/gemini-3.8-flash:generateContent",
data=json.dumps(body).encode("utf-8"),
headers={
"Content-Type": "application/json",
"x-goog-api-key": api_key
},
method="POST",
)
with urlopen(request) as response:
print(json.load(response))The API origin is filled in. Set API_KEY before running. Examples never submit automatically.
200Successful result
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{
"text": "..."
}
]
},
"finishReason": "STOP"
}
]
}- Prepare a request01
API key + model IDUse the model’s native protocol and authentication.
SDK / HTTP - Call the native API02
POST /v1beta/models/{model}:generateContentSubmit the request structure documented on this page.
Gemini - Read the response03
candidates[].contentRead model output from the native response.
JSON
Use the exact API model ID gemini-3.8-flash. This guide describes the platform contract; check the live catalog before calling the model.
Request example
Section titled “Request example”The platform origin is filled in at build time. Set API_KEY to your server-side key before running.
curl "https://newrouters.com/v1beta/models/gemini-3.8-flash:generateContent" \ -H "Content-Type: application/json" \ -H "x-goog-api-key: $API_KEY" \ --data '{ "contents": [ { "role": "user", "parts": [ { "text": "Explain how an HTTP request works in three concise steps." } ] } ], "generationConfig": { "maxOutputTokens": 1024 }}'Protocol and response
Section titled “Protocol and response”This model uses the gemini protocol. Read its native response and usage fields; do not wrap the request in the media task input envelope.
Supported endpoint templates:
POST /v1beta/models/{model}:generateContentPOST /v1beta/models/{model}:streamGenerateContentPOST /v1/interactionsPOST /v1beta/interactions
| Limit | Catalog value |
|---|---|
| Context tokens | 128000 |
| Maximum output tokens | 16384 |
For streaming, use the native protocol streaming option and parse its events; check supported capabilities in the live catalog.
Official sources and identity
Section titled “Official sources and identity”Checked: 2026-09-27 · Platform model: gemini-3.8-flash · Official reference: gemini-3.8-flash
Pricing and troubleshooting
Section titled “Pricing and troubleshooting”Check current availability, contract and account pricing before integration. Keep request IDs and usage receipts when diagnosing errors. Complete API reference