Skip to main content
POST
Create a Gemini chat completion
Use the OpenAI-compatible Chat Completions endpoint with gemini-4-neon, gemini-4-hydrogen, gemini-4-carbon, gemini-4-argon, gemini-3.8-flash, gemini-3.7-flash, or gemini-3.5-flash-lite.

Non-streaming request

The response uses the OpenAI-compatible choices and usage fields.

Streaming request

Set stream to true. GENGEN returns text/event-stream, emits partial Chat Completions chunks, includes final usage, and terminates the stream with data: [DONE].
This is unidirectional text streaming over SSE. It is separate from the bidirectional Gemini Live API.

Reasoning level

Gemini 4 Carbon, Gemini 4 Argon, Gemini 3.8 Flash, and Gemini 3.7 Flash accept low, medium, or high and default to medium. Gemini 3.5 Flash-Lite also accepts minimal, defaults to minimal, and recommends it for extraction and other straightforward, latency-sensitive tasks.

Gemini 3.5 Flash-Lite constraints

Gemini 3.5 Flash-Lite ignores custom temperature, top_p, and top_k values. It rejects frequency_penalty and presence_penalty, and the final non-system message must not use the assistant role.

Parameters

The API fixes candidateCount to 1 so the OpenAI-compatible response always contains one generated choice. Repeated requests with the same seed are not guaranteed to produce identical output. See the Gemini 3.8 Flash, Gemini 3.7 Flash and Gemini 3.5 Flash-Lite model pages for details. Gemini 3.8 Flash defaults to medium reasoning and rejects minimal, unsupported reasoning levels, and thinkingBudget overrides. Use low, medium, or high.

Function calling and built-in tools

Function calling, Code execution, and Computer use are supported for all listed Gemini models. See Gemini tools for complete requests, multi-turn result submission, thought signature preservation, streaming behavior, and billing.

Gemini 4 Carbon and Argon limits

gemini-4-carbon and gemini-4-argon share a 1,048,576-token window between input, reasoning, and output. The default output budget is 32,768 tokens for non-streaming requests and 65,536 with stream: true. Set a larger budget to enable automatic continuation. Reasoning defaults to medium; use low, medium, or high. Thinking budgets and minimal return HTTP 400. Custom temperature, top_p, and top_k values are ignored. Implicit caching is automatic; explicit cache management is not exposed.

Carbon, Hydrogen, and Neon conversation constraints

Gemini 4 Carbon, Hydrogen, and Neon reject frequency_penalty, presence_penalty, and candidate counts other than one (n or advanced candidateCount). End your history with a user message or completed tool results. Assistant prefills are not supported. Return every tool result in the order of the preceding calls, using the matching tool_call_id (Chat Completions) or call_id (Responses). Submit all pending results before another conversation turn. Preserve Google metadata as described in Gemini tools.

Gemini 4 Hydrogen and Neon

Hydrogen and Neon support Google Search, URL Context and Agentic video. Use Count input tokens before generation without a wallet charge. gemini-4-neon and gemini-4-hydrogen default to 65,536 output tokens for synchronous and streaming requests. To allow a longer turn, set the output budget to an integer up to 1,048,576. Input, reasoning, tool calls, and final output share this window. GENGEN follows Gemini 4 continuation segments automatically while the request is open. Usage includes input processed again on later segments, cache reads, and generated tokens. Use streaming for large responses. Foreground calls have a 13-minute upstream deadline, and generation can finish before reaching the requested budget. Use reasoning_effort: "low", "medium", "high" (default), or "xhigh". Thinking budgets and minimal return HTTP 400. Custom temperature, top_p, and top_k are ignored. Implicit caching applies automatically to shared prefixes of at least 4,096 tokens; explicit cache references are not accepted. Preserve providerMetadata.google.parts on every returned assistant item, including final text and previous tool turns. Only the first function call in a parallel turn carries a thought signature. If your application edits or compacts previous history, set the following option; otherwise the default ERROR behavior rejects signatures whose original conversation prefix has changed:
DROP discards mismatched reasoning signatures while retaining visible history; it does not replace missing tool-call metadata. See Gemini tools. Supply Office and OpenDocument inputs through file / input_file content parts using file_data Base64 data URLs with the document’s correct MIME type. The same content parts are accepted inside tool results. Cloud Storage object references are not accepted by the GENGEN media-input interface.

Authorizations

Authorization
string
header
required

A workspace API key beginning with gengen_live_.

Body

application/json
model
enum<string>
required

Public Gemini text model ID.

Available options:
gemini-4-neon,
gemini-4-hydrogen,
gemini-4-carbon,
gemini-4-argon,
gemini-3.8-flash,
gemini-3.7-flash,
gemini-3.5-flash-lite
messages
object[]
required

Conversation messages. Gemini 4 Carbon, Hydrogen, and Neon require a final user or tool-result turn and tool results in function-call order; assistant prefills are not supported. System and developer messages become the Gemini system instruction.

Minimum array length: 1
n
integer

Carbon, Hydrogen, and Neon accept only one candidate. Omit this field or set it to 1.

reasoning_effort
enum<string>

Gemini thinking level. Hydrogen and Neon support low, medium, high (default), and xhigh; thinking budgets and minimal are rejected. minimal is supported by Gemini 3.5 Flash-Lite but not Gemini 4 Carbon, Gemini 4 Argon, Gemini 3.8 Flash or Gemini 3.7 Flash. Gemini 4 Carbon, Gemini 4 Argon, and Gemini 3.8 Flash default to medium and reject thinking budgets.

Available options:
minimal,
low,
medium,
high,
xhigh
temperature
number

Sampling temperature. Higher values increase variation. Custom values are ignored by Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Carbon, Gemini 4 Argon, and Gemini 3.5 Flash-Lite.

top_p
number

Nucleus-sampling probability threshold. Custom values are ignored by Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Carbon, Gemini 4 Argon, and Gemini 3.5 Flash-Lite.

Required range: 0 <= x <= 1
top_k
number

Limits sampling to the most likely K tokens. Custom values are ignored by Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Carbon, Gemini 4 Argon, and Gemini 3.5 Flash-Lite.

Required range: x >= 1
max_tokens
integer

Gemini 4 accepts integer output budgets from 1 through 1048576 with automatic continuation. Input and output share the context window. Neon and Hydrogen default to 65536. Carbon and Argon default to 32768 synchronously and 65536 with streaming. max_completion_tokens is an accepted alias.

Required range: x >= 1
max_completion_tokens
integer

Gemini 4 accepts integer output budgets from 1 through 1048576 with automatic continuation. Input and output share the context window. Neon and Hydrogen default to 65536. Carbon and Argon default to 32768 synchronously and 65536 with streaming.

Required range: x >= 1
stop

One or more sequences that stop generation.

frequency_penalty
number

Penalizes tokens according to how often they already appear. Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Carbon, and Gemini 3.5 Flash-Lite reject this parameter.

presence_penalty
number

Penalizes tokens that have already appeared at least once. Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Carbon, and Gemini 3.5 Flash-Lite reject this parameter.

seed
integer

Best-effort sampling seed. Identical outputs are not guaranteed.

response_format
object
stream
boolean
default:false

Return Server-Sent Events when true.

stream_options
object

Streaming compatibility options.

tools
object[]

Function declarations. Chat uses nested function objects; Responses uses flat function declarations. Built-in tools belong in providerOptions.google.tools.

tool_choice

auto, none, required, or a named function object. The function name must be declared in tools.

Available options:
auto,
none,
required
parallel_tool_calls
boolean

Omit or use true. Gemini can return multiple calls; false is rejected.

providerOptions
object

Response

An OpenAI-compatible chat completion or SSE stream.

id
string
object
string
Allowed value: "chat.completion"
created
integer
model
string
choices
object[]
usage
object