Overview
This endpoint generates content using Gemini models via the official Gemini API format. It supports text generation, image analysis, and multi-turn conversations.
Authentication
This endpoint requires authentication using an API key.
Authorization
string
default: "sk-***********"
required
Your API key
Path Parameters
model
string
default: "gemini-2.5-flash-lite"
required
The model to use for content generation. Available models: gemini-2.5-flash-lite, etc.
Request Body Parameters
An array of content objects representing the conversation history. Show Content Object Structure
The role of the message sender. Typically "user" or "model".
An array of parts that make up the message content. Show Parts Object Structure
Text content of the message.
Inline data for images or other media (base64 encoded).
Response from a function call.
Reference to uploaded file data.
Metadata for video content.
Signature for thought content.
Thought content for reasoning models.
Request Example
curl --location 'https://gptproto.com/v1beta/models/gemini-2.5-flash-lite:streamGenerateContent' \
--header 'Authorization: sk-***********' \
--header 'Content-Type: application/json' \
--data '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "hello"
}
]
}
]
}'
Response
Successful response containing generated content {
"candidates" : [
{
"content" : {
"parts" : [
{
"text" : "Hello! How can I help you today?"
}
],
"role" : "model"
},
"finishReason" : "STOP" ,
"index" : 0 ,
"safetyRatings" : [
{
"category" : "HARM_CATEGORY_SEXUALLY_EXPLICIT" ,
"probability" : "NEGLIGIBLE"
},
{
"category" : "HARM_CATEGORY_HATE_SPEECH" ,
"probability" : "NEGLIGIBLE"
},
{
"category" : "HARM_CATEGORY_HARASSMENT" ,
"probability" : "NEGLIGIBLE"
},
{
"category" : "HARM_CATEGORY_DANGEROUS_CONTENT" ,
"probability" : "NEGLIGIBLE"
}
]
}
],
"usageMetadata" : {
"promptTokenCount" : 2 ,
"candidatesTokenCount" : 8 ,
"totalTokenCount" : 10
}
}
Error Responses
401 - Invalid signature
403 - Invalid Token
403 - Insufficient balance
500 - Internal server error
503 - Content policy violation
{
"error" : {
"message" : "Invalid signature" ,
"type" : "401"
}
}