# Generate content (Google) (/docs/reference/google-compatible/googleGenerateContent)

> For AI agents, the [documentation index](https://bitrouter-docs-staging.up.railway.app/llms.txt) lists all pages. Append .md to a documentation URL to read its Markdown.

`POST /v1beta/models/{model_action}`

Generates content using the Google Generative Language API format. Drop-in replacement for `generativelanguage.googleapis.com/v1beta`.

The model id and streaming verb are both encoded in the `model_action` path segment — for example `gemini-2.0-flash:generateContent` (synchronous) or `gemini-2.0-flash:streamGenerateContent` (SSE). The cloud injects the model id into the request body before dispatching, so callers can use the same URL convention as Google's own API.

## Authentication

header parameter `x-api-key` or `Authorization: Bearer <token>`.

Base URL: `https://api.bitrouter.ai`

## Parameters

* `model_action` (path, required): `{model}:{action}` segment — Google encodes both the model id and the streaming verb in one path component. `action` is either `generateContent` (synchronous) or `streamGenerateContent` (SSE). Example: `gemini-2.0-flash:generateContent`.

## Request body

Google Generative Language `:generateContent` request.

Media types: `application/json`.

* `contents` (required): array
* `generationConfig`
* `model`: string
* `stream`: boolean
* `systemInstruction`
* `tools`: array

## Responses

* `200` Generated content (non-streaming). Streamed generation — Server-Sent Events, one JSON object per `data:` line. Use the `:streamGenerateContent` action to opt in. (application/json, text/event-stream)
* `400` Bad request — invalid model or malformed request body. (application/json)
* `402` Payment required — insufficient balance or missing payment proof. (application/json)
* `404` No route found for the requested model. (application/json)
* `429` Rate limited by BitRouter or by every usable upstream route. Inspect error.code to distinguish rate\_limit\_exceeded from upstream\_rate\_limited; Retry-After is included when known. (application/json)
* `500` BitRouter internal error. (application/json)
* `502` Upstream returned an invalid response. (application/json)
* `503` The usable upstream route set is temporarily unavailable. (application/json)
* `504` Every usable upstream route timed out. (application/json)

[Full OpenAPI schema](https://bitrouter-docs-staging.up.railway.app/openapi.json)