Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
Text to Text (No Stream)
curl --request POST \
  --url https://gptproto.com/v1beta/models/{model}:generateContent \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '{
  "contents": [
    {
      "role": "<string>",
      "parts": [
        {
          "text": "<string>",
          "inlineData": {},
          "functionResponse": {},
          "fileData": {},
          "videoMetadata": {},
          "functionCall": {},
          "functionCalls": [
            {}
          ],
          "thoughtSignature": "<string>",
          "thought": "<string>"
        }
      ]
    }
  ]
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

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

contents
array
required
An array of content objects representing the conversation history.

Request Example

curl --location 'https://gptproto.com/v1beta/models/gemini-2.5-flash-lite:generateContent' \
--header 'Authorization: sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "hello"
                }
            ]
        }
    ]
}'

Response

Success
200
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

{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}