Skip to main content
google avatar

Gemini 3.5 Flash API

google/gemini-3.5-flash

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="")
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>

Streaming 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

Summarise this support ticket in three bullets, then classify its urgency as low, medium or high with a one-line reason. Ticket: Since this morning our checkout page shows a blank screen for customers on Safari. Chrome works. We are losing orders — about 30% of our traffic is Safari. No code was deployed on our side. We did update the payments SDK yesterday.

**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.

Input tokens
$1.5
per 1M tokens
Cached input tokens
$0.15
per 1M tokens
Output tokens
$9
per 1M tokens

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.

Per request$0.00750
Per day$7.501,000 requests

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

ModelInput / 1MOutput / 1MContextMax outputFeatures
Gemini 3.5 Flashgoogle/gemini-3.5-flash$1.5$91M65.5Kreasoning, tool calling, json mode
Gemini 3.5 Flash-Litegoogle/gemini-3.5-flash-lite$0.3$2.51M65.5Ktool calling, json mode
Gemini 3.7 Flashgoogle/gemini-3.7-flash$0.75$3.751M65.5Kreasoning, tool calling, json mode
DeepSeek V4 Prodeepseek/v4$2.4$4.81M393.2Kreasoning, tool calling, json mode
GLM-5.2z-ai/glm-5.2$1.4$4.41M131.1Kreasoning, tool calling, json mode
GLM-5.2 Fast Previewz-ai/glm-5.2-fast-preview$2.8$8.81M131.1Kreasoning, tool calling, json mode
Qwen3.8-Maxalibaba/qwen3.8-max$2$61M131.1Kreasoning, 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.

Request parameters of Gemini 3.5 Flash
NameTypeRequiredDescription
messagesarrayyesOpenAI-style conversation history. Each item is an object with a role (system, user, assistant or tool) and content.
streambooleannoReturn the reply as a Server-Sent Events stream of deltas terminated by data: [DONE]. Default: false.
temperaturenumbernoSampling temperature. Lower is more deterministic.
max_tokensintegernoUpper bound on generated tokens.
top_pnumbernoNucleus sampling probability mass.
toolsarraynoOpenAI-format tool definitions the model may call.
tool_choicenoauto, none, required, or a specific tool.
response_formatobjectnoSet {"type":"json_object"} for JSON mode.
stopnoUp to 4 stop sequences.
seedintegernoBest-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.)