Skip to main content
POST
/
v1beta
/
models
/
{model}
:generateContent
File Analysis (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>",
          "file_data": {
            "mime_type": "<string>",
            "file_uri": "<string>"
          }
        }
      ]
    }
  ]
}'
{
  "error": {
    "message": "Input may not meet the guidelines. Please adjust and try again.",
    "type": "503"
  }
}

Overview

This endpoint provides file analysis functionality (no stream).

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-nothinking"
required
The model to use for the file analysis. Available models: gemini-2.5-flash-nothinking, etc.

Request Body Parameters

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

Request Example

curl --location 'https://gptproto.com/v1beta/models/gemini-2.5-flash-nothinking:generateContent' \
--header 'Authorization: sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "role": "user",
            "parts": [
                {
                    "text": "帮我分析这份文件"
                },
                {
                    "file_data": {
                        "mime_type": "application/pdf",
                        "file_uri": "https://oss.heyoos.com/ai-draw/material/Essential-English.pdf"
                    }
                }
            ]
        }
    ]
}'

Response

Success
200
Successful response containing file analysis results
{
  "candidates": [
    {
      "content": {
        "parts": [
          {
            "text": "这是一份名为《Essential English》的PDF文档。根据文档内容分析,这是一本英语学习教材..."
          }
        ],
        "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": 1520,
    "candidatesTokenCount": 256,
    "totalTokenCount": 1776
  }
}

Error Responses

{
  "error": {
    "message": "Input may not meet the guidelines. Please adjust and try again.",
    "type": "503"
  }
}