Skip to main content

Gemini protocol

Send content using the Gemini generateContent format.

Service address

This page covers native Gemini REST model discovery, content generation, streaming, and embeddings. Use the Gemini native image guide for image-specific parameters.

Models and discovery

PurposeMethodPath
Gemini model listGET/v1beta/models
Gemini compatible model listGET/v1/models

Content generation

PurposeMethodPath
generateContentPOST/v1beta/models/{model}:generateContent
streamGenerateContentPOST/v1beta/models/{model}:streamGenerateContent

Embeddings

PurposeMethodPath
embedContentPOST/v1beta/models/{model}:embedContent
batchEmbedContentsPOST/v1beta/models/{model}:batchEmbedContents
Gemini compatible embeddingsPOST/v1/engines/{model}/embeddings

Minimal request

Replace YOUR_MODEL with the actual model ID and keep it in the URL path. Prefer x-goog-api-key: YOUR_API_KEY; the gateway also accepts Bearer. Use the key query parameter only when a client explicitly requires it, because URLs can be logged.

curl "https://api.popgo.site/v1beta/models/YOUR_MODEL:generateContent" \
-H "x-goog-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{"parts": [{"text": "Reply with a connection confirmation"}]}
]
}'

Verify

A successful response contains candidate content or embeddings. Use streamGenerateContent for streaming; choose embedContent, batchEmbedContents, or the compatible embedding path for embeddings. For a 404, check the model ID, protocol path, and Key group.