Gemini 3.5 Flash API
Fast, general-purpose text model served over an OpenAI-compatible chat completions endpoint, with tool calling, JSON mode and streaming.
- Context window
- 1M tokens
- Max output
- 65.5K tokens
- Input
- $1.5 / 1M tokens
- Output
- $9 / 1M tokens
- Cached input
- $0.15 / 1M tokens
- Modalities
- text → text
- Features
- reasoningtool callingjson modestreaming
Connect to Gemini 3.5 Flash
Gemini 3.5 Flash is served through an OpenAI-compatible chat completions API. Point any OpenAI SDK or OpenAI-compatible tool at the base URL below with a ModelRunner API key — no polling, the reply comes back in the response (or streams).
- base_url
- https://queue.modelrunner.run/google/gemini-3.5-flash
- model
- google/gemini-3.5-flash
- auth
- Authorization: Bearer <MODELRUNNER_API_KEY>get a key
import os
from openai import OpenAI
client = OpenAI(
base_url="https://queue.modelrunner.run/google/gemini-3.5-flash",
api_key=os.environ["MODELRUNNER_API_KEY"],
)
completion = client.chat.completions.create(
model="google/gemini-3.5-flash",
messages=[
{
"role": "user",
"content": "Explain what an API rate limit is in two sentences."
}
],
reasoning_effort="medium", # low | medium | high — thinking bills as output tokens
)
print(completion.choices[0].message.content)
# Streaming: add stream=True and iterate the chunks
# for chunk in client.chat.completions.create(..., stream=True):
# print(chunk.choices[0].delta.content or "", end="")import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://queue.modelrunner.run/google/gemini-3.5-flash",
apiKey: process.env.MODELRUNNER_API_KEY,
});
const completion = await client.chat.completions.create({
model: "google/gemini-3.5-flash",
messages: [
{
"role": "user",
"content": "Explain what an API rate limit is in two sentences."
}
],
reasoning_effort: "medium", // low | medium | high — thinking bills as output tokens
});
const reply = completion.choices[0].message.content;
// Streaming: pass stream: true and iterate the chunks
// for await (const chunk of await client.chat.completions.create({ ..., stream: true })) {
// process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
// }# One synchronous call — the reply is in the response body (no polling)
curl https://queue.modelrunner.run/google/gemini-3.5-flash/chat/completions \
-H "Authorization: Bearer $MODELRUNNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Explain what an API rate limit is in two sentences."
}
],
"reasoning_effort": "medium"
}'
# Streaming (Server-Sent Events, ends with "data: [DONE]")
curl -N https://queue.modelrunner.run/google/gemini-3.5-flash/chat/completions \
-H "Authorization: Bearer $MODELRUNNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Explain what an API rate limit is in two sentences."
}
],
"reasoning_effort": "medium",
"stream": true
}'Works withCline · Continue · Claude Code · LangChain · Vercel AI SDK · LiteLLM · Aider
Cline → Settings → API Configuration (or the CLI line below)
API Provider: OpenAI Compatible
Base URL: https://queue.modelrunner.run/google/gemini-3.5-flash
API Key: <your ModelRunner API key>
Model ID: google/gemini-3.5-flash
# Cline CLI equivalent
cline auth --provider openai --baseurl https://queue.modelrunner.run/google/gemini-3.5-flash --modelid google/gemini-3.5-flash --apikey <your ModelRunner API key>~/.continue/config.yaml (the IDE extension and the `cn` CLI read the same file)
models:
- name: Gemini 3.5 Flash (ModelRunner)
provider: openai
model: google/gemini-3.5-flash
apiBase: https://queue.modelrunner.run/google/gemini-3.5-flash
apiKey: <your ModelRunner API key>
roles: [chat, edit]shell environment (or the env block of ~/.claude/settings.json)
export ANTHROPIC_BASE_URL=https://queue.modelrunner.run/google/gemini-3.5-flash
export ANTHROPIC_AUTH_TOKEN=<your ModelRunner API key>
export ANTHROPIC_MODEL=google/gemini-3.5-flash
# optional: send Claude Code's background/sub-agent calls to the same model
export ANTHROPIC_DEFAULT_HAIKU_MODEL=google/gemini-3.5-flash
export CLAUDE_CODE_SUBAGENT_MODEL=google/gemini-3.5-flash
claudeimport os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
base_url="https://queue.modelrunner.run/google/gemini-3.5-flash",
api_key=os.environ["MODELRUNNER_API_KEY"],
model="google/gemini-3.5-flash",
)
llm.invoke("Explain what an API rate limit is in two sentences.")import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { generateText } from "ai";
const modelrunner = createOpenAICompatible({
name: "modelrunner",
baseURL: "https://queue.modelrunner.run/google/gemini-3.5-flash",
apiKey: process.env.MODELRUNNER_API_KEY,
});
const { text } = await generateText({
model: modelrunner("google/gemini-3.5-flash"),
prompt: "Explain what an API rate limit is in two sentences.",
});import os
import litellm
response = litellm.completion(
model="openai/google/gemini-3.5-flash", # "openai/" = OpenAI-compatible route
api_base="https://queue.modelrunner.run/google/gemini-3.5-flash",
api_key=os.environ["MODELRUNNER_API_KEY"],
messages=[{"role": "user", "content": "Explain what an API rate limit is in two sentences."}],
)
print(response.choices[0].message.content)terminal
export OPENAI_API_BASE=https://queue.modelrunner.run/google/gemini-3.5-flash
export OPENAI_API_KEY=<your ModelRunner API key>
aider --model openai/google/gemini-3.5-flashStreaming via SSE (stream: true; ends with data: [DONE]) · Non-streaming calls time out at ~290 s — stream long generations · 10 MB request body · Errors use the OpenAI error envelope · Optional metadata object for your own tags, never sent to the model · Many models, one provider entry: base_url https://queue.modelrunner.run/v1 (GET /v1/models lists ids; model field required)
From an MCP client (Claude Desktop, Cursor, Claude Code): connect the ModelRunner MCP server once and its run_model tool runs Gemini 3.5 Flash with a messages input — the reply comes back in the same call.
Machine-readable: OpenAPI schema · llms.txt
Example conversation
A real run of Gemini 3.5 Flash on ModelRunner · charged $0.0082 · 79 in / 111 out / 529 reasoning tokens
**Summary:** * The checkout page is displaying a blank screen specifically for Safari users (while Chrome continues to work), starting this morning. * The issue is directly causing lost orders and impacts approximately 30% of the website's total traffic. * While no internal code was deployed, the payments SDK was updated yesterday, indicating a likely cause for the breakage.
**Urgency:** High **Reason:** This is a critical, revenue-blocking issue that prevents 30% of customers from completing purchases on the checkout page.
Model Pricing
Pricing
This model is billed per token, at separate rates for what you send and what it produces.
If a run reports no token usage, it bills a flat $0.01.
Cost estimator
Estimate from the rates above — your bill is the model's reported usage × rate, exact to 6 decimals.
This model thinks before it answers. Thinking tokens bill at the output rate and are often several times the visible reply — count them in the output figure, or set a lower reasoning effort.
Compare tiers and related models
| Model | Input / 1M | Output / 1M | Context | Max output | Features |
|---|---|---|---|---|---|
| Gemini 3.5 Flashgoogle/gemini-3.5-flash | $1.5 | $9 | 1M | 65.5K | reasoning, tool calling, json mode |
| Gemini 3.5 Flash-Litegoogle/gemini-3.5-flash-lite | $0.3 | $2.5 | 1M | 65.5K | tool calling, json mode |
| Gemini 3.7 Flashgoogle/gemini-3.7-flash | $0.75 | $3.75 | 1M | 65.5K | reasoning, tool calling, json mode |
| DeepSeek V4 Prodeepseek/v4 | $2.4 | $4.8 | 1M | 393.2K | reasoning, tool calling, json mode |
| GLM-5.2z-ai/glm-5.2 | $1.4 | $4.4 | 1M | 131.1K | reasoning, tool calling, json mode |
| GLM-5.2 Fast Previewz-ai/glm-5.2-fast-preview | $2.8 | $8.8 | 1M | 131.1K | reasoning, tool calling, json mode |
| Qwen3.8-Maxalibaba/qwen3.8-max | $2 | $6 | 1M | 131.1K | reasoning, tool calling, json mode |
Request parameters
The body follows OpenAI’s chat completions shape. Fields below are the ones this model documents; anything else the platform does not interpret is forwarded to the model unchanged, and the model is the authority on what it accepts.
| Name | Type | Required | Description |
|---|---|---|---|
| messages | array | yes | OpenAI-style conversation history. Each item is an object with a role (system, user, assistant or tool) and content. |
| stream | boolean | no | Return the reply as a Server-Sent Events stream of deltas terminated by data: [DONE]. Default: false. |
| temperature | number | no | Sampling temperature. Lower is more deterministic. |
| max_tokens | integer | no | Upper bound on generated tokens. |
| top_p | number | no | Nucleus sampling probability mass. |
| tools | array | no | OpenAI-format tool definitions the model may call. |
| tool_choice | — | no | auto, none, required, or a specific tool. |
| response_format | object | no | Set {"type":"json_object"} for JSON mode. |
| stop | — | no | Up to 4 stop sequences. |
| seed | integer | no | Best-effort determinism hint. |
Response
An OpenAI ChatCompletion object: id, object, created, model, choices[] and usage. The id is chatcmpl-<requestId>, and the same request appears in your dashboard.
About Gemini 3.5 Flash
Gemini 3.5 Flash is a fast, general-purpose large language model for everyday text work: summarisation, extraction, classification, rewriting, code assistance and multi-turn conversation.
Best for
- Drop-in OpenAI-compatible chat endpoint for an AI coding assistant or agent
- Summarise, classify, extract or rewrite text at low cost per token
- Multi-turn conversation with streaming responses
- Tool calling and structured JSON output from a fast general-purpose model
How it thinks
Gemini 3.5 Flash reasons before it answers. Thinking tokens are billed at the output rate and reported as usage.completion_tokens_details.reasoning_tokens.
Notesshow the full description ›
It is the middle tier of the Gemini text family on ModelRunner — a solid default for chat-style product features, agent tool loops and everyday summarisation, extraction and rewriting. Repeated system prompts and long shared context are cached automatically and billed at the reduced cached-input rate, which cuts cost sharply on prompts that share a prefix.
## Choose another model when - Volume matters more than quality — Gemini 3.5 Flash-Lite is roughly a fifth of the cost per token - A task needs deeper multi-step reasoning — Gemini 3.7 Flash thinks before it answers - Your input includes images, audio or video — this endpoint is text-only
## Tips - `temperature` and `top_p` are accepted on this generation (Gemini 3.7 Flash drops them) - Pair `response_format: {"type": "json_object"}` with an explicit JSON instruction in the prompt for the most reliable structured output
Behaviour & limits
- Context window
- 1M tokens (input + output)
- Max output
- 65.5K tokens per reply — thinking counts against this budget
- Sampling controls
temperaturetop_p- Structured calls
- OpenAI-format tools + tool_choice · response_format JSON mode
- Transport
- OpenAI-compatible chat completions · SSE streaming · ~290 s non-stream ceiling · 10 MB body
FAQ
How do I connect to Gemini 3.5 Flash through the API?
Gemini 3.5 Flash is served by an OpenAI-compatible chat completions endpoint. Point any OpenAI SDK or OpenAI-compatible tool at base_url https://queue.modelrunner.run/google/gemini-3.5-flash with a ModelRunner API key (Authorization: Bearer <key>) and model google/gemini-3.5-flash; the SDK appends /chat/completions itself. The call is synchronous — the reply comes back in the response body, or streams as Server-Sent Events with "stream": true. Do not submit it to the asynchronous queue path, which returns HTTP 400 for this model.
How much does Gemini 3.5 Flash cost?
Gemini 3.5 Flash is billed per token from the usage the model reports: $1.5 per 1M input tokens, $0.15 per 1M cached input tokens, $9 per 1M output tokens. Thinking (reasoning) tokens bill at the output rate. There is no per-request minimum — a short call bills a fraction of a cent, exact to six decimals.
What is Gemini 3.5 Flash's context window?
Gemini 3.5 Flash supports a 1M-token context window and up to 65.5K output tokens per reply — thinking tokens count against the output budget, so leave headroom in max_tokens.
Can I use Gemini 3.5 Flash in GitHub Copilot or another tool that requires a /models endpoint?
Yes. Custom-provider flows that probe GET {base_url}/models before first use (GitHub Copilot's BYOK flow does) work with either base URL: https://queue.modelrunner.run/google/gemini-3.5-flash self-describes at https://queue.modelrunner.run/google/gemini-3.5-flash/models, and the platform base https://queue.modelrunner.run/v1 covers every public chat model with one provider entry — GET /v1/models lists the ids and the request's model field selects google/gemini-3.5-flash.
Does Gemini 3.5 Flash support streaming?
Yes. Set "stream": true and the reply arrives as Server-Sent Events (data: frames ending with data: [DONE]); stream_options: {"include_usage": true} adds a final usage frame. Non-streaming calls are cut off at about 290 seconds, so stream long generations.
Does Gemini 3.5 Flash support tool calling or JSON mode?
Gemini 3.5 Flash supports function calling via an OpenAI-format tools array with tool_choice and JSON mode via response_format {"type": "json_object"}. Both are passed through to the model in the standard OpenAI chat completions shape, so existing client code works unchanged.
What happens if my ModelRunner balance runs out while calling Gemini 3.5 Flash?
The request is refused with HTTP 429 and an OpenAI-style error whose code is insufficient_quota — the convention OpenAI SDKs already understand — and nothing is charged. Top up in the dashboard and retry. (Disconnecting from a stream after output has started is not a refund — the platform finishes the upstream call and bills its exact usage.)
