Chat Completion
Call Gemini models in OpenAI-compatible format to generate responses.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The Gemini model ID used for completion.
gemini-3.1-pro-preview, gemini-3.1-flash-image-preview, gemini-3.1-flash-lite-preview, gemini-3-pro-preview, gemini-3-pro-image-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-2.0-flash "gemini-2.5-pro"
The list of messages that make up the current conversation.
1Maximum number of tokens to generate in the chat completion.
x >= 1Sampling temperature, from 0 to 2.
0 <= x <= 21
Nucleus sampling threshold.
0 <= x <= 1Penalize new tokens based on how often they already appear in the text.
-2 <= x <= 2Penalize new tokens if they have already appeared in the text.
-2 <= x <= 2If true, partial messages are streamed via SSE.
The API stops generating further tokens when these sequences appear.
How many completion choices to generate for each input message.
x >= 1Specify the format the model must output. Set {"type": "json_object"} to enable JSON mode.