Skip to content
HomeModels
DocsText & chat

Gemini generate content

Send text and multimodal content through the native Gemini endpoint, preserving contents, parts, and generationConfig.

Google Gemini compatibleStreaming supported
POST/v1beta/models/{model}:generateContent
Base URLhttps://api.linkinfra.ai

Authorization

Bearer Token
AuthorizationBearer <token>

Authenticate requests with your API key in the request header:

Authorization: Bearer sk-your-api-key

Need a key? Create one in the console

Place the model ID in the URL path. Both Bearer tokens and the x-goog-api-key header are supported.

modelstringrequired

Gemini model ID without the models/ prefix.

Request body

application/json
contentsarray<object>required

Conversation content in the native Gemini format.

Show child properties2
rolestring

Content role: user or model.

partsarray<object>required

Text, image, or audio content parts.

Show child properties2
textstring

Text content.

inlineDataobject

Inline media with mimeType and Base64-encoded data.

generationConfigobject

Generation settings such as temperature and maxOutputTokens.

For streaming, use /v1beta/models/{model}:streamGenerateContent?alt=sse with the same request body.

Response

application/json
200Successful response
candidatesarray<object>

Generated candidates. Content is in content.parts.

usageMetadataobject

Input, output, and total token usage.

Request failed? Read the error handling guide