Generate content (Google)

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.

POST
/v1beta/models/{model_action}

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.

Response Body

application/json

application/json

application/json

curl -X POST "https://api.bitrouter.ai/v1beta/models/string" \  -H "Content-Type: application/json" \  -d '{    "contents": [      null    ]  }'
{}
{
  "error": null
}
{
  "error": null
}
{
  "error": null
}

How is this guide?