Skip to main content
POST
/
v1
/
models
/
gemini-3-pro-preview:generateContent
gemini-3-pro-preview (file analysis)
curl --request POST \
  --url https://api.example.com/v1/models/gemini-3-pro-preview:generateContent
Gemini’s official format for the file analysis API.
curl --location 'https://gptproto.com/v1/models/gemini-3-pro-preview:generateContent' \
--header 'Authorization: Bearer sk-***********' \
--header 'Content-Type: application/json' \
--data '{
    "contents": [
        {
            "parts": [
                {
                    "text": "帮我分析这份文件"
                },
                {
                    "fileData": {
                        "mimeType": "application/pdf",
                        "fileUri": "https://oss.heyoos.com/ai-draw/material/Essential-English.pdf"
                    }
                }
            ]
        }
    ],
    "generationConfig": {
        "temperature": 0.3
    },
    "safetySettings": [
        {
            "category": "HARM_CATEGORY_HARASSMENT",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        },
        {
            "category": "HARM_CATEGORY_HATE_SPEECH",
            "threshold": "BLOCK_MEDIUM_AND_ABOVE"
        }
    ]
}'
{
  "error": {
    "code": 400,
    "message": "Content blocked due to safety concerns.",
    "status": "INVALID_ARGUMENT"
  }
}

Parameters

ParameterTypeRequiredDefaultDescription
contentsarray✅ Yes-Contains the content to be analyzed, including text and file references.
partsarray✅ Yes-Parts of the content, can include text and file data.
textstring✅ Yes-The text prompt for the file analysis.
fileDataobject✅ Yes-The file to analyze.
mimeTypestring✅ Yes-The MIME type of the file (e.g., “application/pdf”).
fileUristring✅ Yes-The URL of the file to analyze.
generationConfigobject❌ No-Generation configuration settings.
temperaturenumber❌ No0.3Controls randomness in the response (0.0 to 1.0).
safetySettingsarray❌ No-Safety settings for content filtering.
categorystring✅ Yes-The harm category to filter.
thresholdstring✅ Yes-The threshold for blocking content (e.g., “BLOCK_MEDIUM_AND_ABOVE”).