Skip to main content
POST
/
v1beta
/
models
/
{model}
:streamGenerateContent
gemini-2.0-flash (file analysis)
curl --request POST \
  --url https://api.example.com/v1beta/models/{model}:streamGenerateContent
Gemini’s official format for the file analysis with stream API.
curl -X POST "https://gptproto.com/v1beta/models/gemini-2.0-flash:streamGenerateContent" \
  -H "Authorization: sk-***********" \
  -H "Content-Type: application/json" \
  -d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Please summarize the main content of this PDF"
        },
        {
          "file_data": {
            "mime_type": "application/pdf",
            "file_uri": "https://oss.heyoos.com/ai-draw/material/Essential-English.pdf"
          }
        }
      ]
    }
  ]
}'
{
  "error": {
    "message": "Invalid signature",
    "type": "401"
  }
}

Path Parameters

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray✅ Yes-An array of content objects representing the conversation history and file data. The role of the message sender. Typically "user" or "model". Optional for single-turn requests.
partsarray✅ Yes-An array of parts that make up the message content. Can include both text and file data. Text content of the message or prompt for analyzing the file.
file_dataobject❌ No-Reference to file data for analysis (PDF, images, etc.). The MIME type of the file (e.g., "application/pdf", "image/jpeg", "image/png").
file_uristring✅ Yes-The URI of the file to analyze. Can be a public URL.
inlineDataobject❌ No-Inline data for images or other media (base64 encoded).
functionResponseobject❌ No-Response from a function call.
videoMetadataobject❌ No-Metadata for video content.
functionCallobject❌ No-Function call request.
functionCallsarray❌ No-Multiple function calls.
thoughtSignaturestring❌ No-Signature for thought content.
thoughtstring❌ No-Thought content for reasoning models.