curl --request POST \
--url https://api.getinfinityblue.com/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hi, introduce Gemini in one sentence."
}
]
}
]
}
'{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{
"text": "<string>"
}
]
},
"finishReason": "<string>",
"safetyRatings": [
{
"category": "<string>",
"probability": "<string>"
}
]
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}Gemini format
Gemini generate content
Text chat and image / PDF / audio / video recognition using the Gemini native API format
POST
/
v1beta
/
models
/
{model}
:generateContent
curl --request POST \
--url https://api.getinfinityblue.com/v1beta/models/{model}:generateContent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hi, introduce Gemini in one sentence."
}
]
}
]
}
'{
"candidates": [
{
"content": {
"role": "<string>",
"parts": [
{
"text": "<string>"
}
]
},
"finishReason": "<string>",
"safetyRatings": [
{
"category": "<string>",
"probability": "<string>"
}
]
}
],
"usageMetadata": {
"promptTokenCount": 123,
"candidatesTokenCount": 123,
"totalTokenCount": 123
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}{
"error": {
"message": "Invalid duration. Supported range is 4 to 15 seconds.",
"type": "invalid_request_error",
"param": "seconds",
"code": "invalid_duration"
}
}Models you can use
| Model ID | Notes |
|---|---|
gemini-3.1-pro-preview | Gemini flagship — strong multimodal, very long context |
gemini-2.5-pro | High-performance multimodal, up to 1M token context |
gemini-2.5-flash | Fast, lightweight — optimized for high-volume workloads |
GET /v1/models for the full list.
Multi-turn conversations
Alternaterole: user and role: model entries in the contents array
to build a multi-turn conversation.
Media recognition
Add aninlineData entry in parts with a mimeType (e.g.
image/jpeg, application/pdf, audio/mpeg, video/mp4) and the
base64-encoded file data.
Streaming
Replace:generateContent in the path with
:streamGenerateContent?alt=sse to switch to SSE streaming mode.
Safety filtering
UsesafetySettings to adjust the blocking threshold for each harm
category.
System instructions
Pass a system-level prompt viasystemInstruction, using the same
parts format as contents.Authorizations
Path Parameters
Model name, e.g. gemini-2.5-pro or gemini-2.5-flash.
Example:
"gemini-2.5-pro"
Body
application/json
Gemini generateContent request body, used for both text chat and media recognition.
Conversation contents in chronological order. Each element has a
role (user or model) and a parts array of content fragments.
Show child attributes
Show child attributes
Generation parameter configuration.
Show child attributes
Show child attributes
Safety filter settings to adjust blocking thresholds per harm category.
Show child attributes
Show child attributes
Tool list for function calling.
System-level instruction in the same format as a contents element.
Show child attributes
Show child attributes