Google CompatibleGenerate content (Google)

Generate content (Google)

1 min readEdit this page
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.

Authorization

x-api-key<token>

Anthropic-style API key header.

In: header

Path Parameters

model_action*string

{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

application/json

Google Generative Language :generateContent request.

TypeScript Definitions

Use the request body type in TypeScript.

Generate Content generateContent request body (https://ai.google.dev/api/generate-content).

pub so downstream crates (notably bitrouter-cloud) can derive an OpenAPI schema from the canonical wire shape without redeclaring it.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1beta/models/string" \  -H "Content-Type: application/json" \  -d '{    "contents": [      {}    ]  }'
{}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}
{  "error": {    "code": "string",    "message": "string"  }}

How is this guide?