Skip to main content
POST Non-streaming https://api.poixe.com/v1beta/models/gemini-2.5-flash:generateContentPOST Streaming https://api.poixe.com/v1beta/models/gemini-2.5-flash:streamGenerateContent?alt=sse
This is Google’s unified generative API for developers: it uses a consistent input/output structure to cover text, multimodal, and tool-augmented scenarios.

Streaming calls (SSE)

In Gemini, non-streaming and streaming are two different endpoints, and the request URL contains the model name (for example .../models/gemini-2.5-flash:xxx), rather than only specifying the model in the body as some protocols do.
  • Non-streaming: POST ...:generateContent
  • Streaming: POST ...:streamGenerateContent?alt=sse

Authentication and request headers

Every request must carry an API key in the HTTP headers.
string
required
Google API key. Example format: $POIXE_API_KEY.
string
required
Must be set to application/json.

Request parameters

The following are the most commonly used core request fields (covering single-turn text, multi-turn chat, and common sampling controls).
object[]
required
The conversation content (or single-turn input). Gemini uses contents[] to represent “conversation history + current turn input”.
object
System instruction (optional). Used to hold developer/system-level constraints; it is also a Content object (usually containing only text).
object
Generation parameters (optional), used to control sampling, length, and output format.
object[]
The list of tools (optional). Used for capabilities such as function calling and code execution (support may vary by model and capability).
object
Tool configuration (optional). Used to specify the tool selection strategy, constraints, and so on (usually used together with tools).
object[]
Safety settings (optional). Used to override the default content safety thresholds (configured per category).

Response structure

A non-streaming request returns a GenerateContentResponse object; a streaming request returns multiple GenerateContentResponse chunks over SSE (you will continuously receive multiple data: {...} JSON lines).
object[]
The list of candidate results (usually you only need candidates[0]).
object
Prompt safety feedback (if returned). When a prompt is filtered or blocked, you can usually find the reason here.
object
Token usage statistics (output field). We recommend interpreting and recording Gemini’s billing basis as follows: input_tokens = promptTokenCount + toolUsePromptTokenCount, output_tokens = candidatesTokenCount + thoughtsTokenCount, total_tokens = input_tokens + output_tokens (usually matches totalTokenCount).
string
The model version actually used (output field).
string
The unique response identifier (output field).

Official docs: Text generation (Gemini API)

View Gemini’s text generation guide, examples, and best practices.