googleGemini Native Format

Generate Content (Gemini Format)

post

Generates content using Google's native Gemini API format. This is a drop-in replacement for Google's generateContent endpoint — simply replace generativelanguage.googleapis.com with api.fastrouter.ai in your base URL and use your FastRouter API key.

Full URL: POST https://api.fastrouter.ai/v1/models/{model}:generateContent?key=YOUR_FASTROUTER_API_KEY

Authentication: Pass your FastRouter API key via the ?key=YOUR_API_KEY query parameter (Google Gemini style).

Request/Response format: Identical to Google's Gemini API. The request body uses contents (with parts) and generationConfig. The response includes candidates with generated content and usageMetadata with token counts.

Cost tracking: The response usageMetadata object includes a cost field showing credits consumed.

Authorizations
keystringRequired

FastRouter API Key (Gemini style). Get yours at https://fastrouter.ai

Format: ?key=YOUR_API_KEY

Path parameters
modelstringRequired

The Gemini model ID to use (e.g. gemini-2.5-pro, gemini-2.5-flash).

Example: gemini-2.5-pro
Query parameters
keystringRequired

FastRouter API key (Gemini style: pass as query parameter).

Body
Responses
chevron-right
200

Successful response with generated content.

application/json
modelVersionstringOptional
post
/v1/models/{model}:generateContent

Stream Generate Content (Gemini Format)

post

Generates content using Google's native Gemini API format with streaming. Returns Server-Sent Events (SSE) with incremental content chunks. This is a drop-in replacement for Google's streamGenerateContent endpoint.

Full URL: POST https://api.fastrouter.ai/v1/models/{model}:streamGenerateContent?key=YOUR_FASTROUTER_API_KEY

Authentication: Pass your FastRouter API key via the ?key=YOUR_API_KEY query parameter (Google Gemini style).

Streaming format: Returns SSE events with data: prefixed JSON objects. Each chunk contains partial candidates with generated content. The final chunk includes usageMetadata with token counts and a cost field.

Cost tracking: The final streamed chunk's usageMetadata object includes a cost field showing credits consumed.

Authorizations
keystringRequired

FastRouter API Key (Gemini style). Get yours at https://fastrouter.ai

Format: ?key=YOUR_API_KEY

Path parameters
modelstringRequired

The Gemini model ID to use (e.g. gemini-2.5-pro, gemini-2.5-flash).

Example: gemini-2.5-pro
Query parameters
keystringRequired

FastRouter API key (Gemini style: pass as query parameter).

Body
Responses
chevron-right
200

Streaming response with Server-Sent Events containing generated content chunks.

text/event-stream

Each SSE event contains a JSON object with partial candidates and usage metadata.

post
/v1/models/{model}:streamGenerateContent

Last updated