Skip to main content
POST
/
v1
/
messages
File Analysis
curl --request POST \
  --url https://gptproto.com/v1/messages \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --header 'anthropic-version: <anthropic-version>' \
  --data '{
  "model": "<string>",
  "messages": [
    {}
  ],
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "top_k": 123,
  "stream": true,
  "stop_sequences": [
    {}
  ]
}'
{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key"
  }
}

Overview

This endpoint provides file analysis functionality using Anthropic native format. Upload files or provide file URLs to extract content, analyze data, summarize documents, or process structured information from various file formats including PDF, DOCX, TXT, and more.

Authentication

This endpoint requires authentication using an API key header.
Authorization
string
required
Your API key for authentication
anthropic-version
string
default:"2023-06-01"
required
The version of the Anthropic API to use

Request Body

model
string
default:"claude-sonnet-4-20250514"
required
The model to use for file analysis
messages
array
required
Array of message objects for the conversation. Each message must have a role (user or assistant) and content. Content can include:
  • Text blocks with type “text”
  • Document blocks with type “document” containing:
    • source: Object with type “base64” or “url”
    • For base64: media_type (e.g., “application/pdf”) and data (base64 string)
    • For url: url field with the file URL
Supported file formats: PDF, DOCX, XLSX, TXT, CSV, JSON, XML, HTMLMaximum file size: 20MBExample with URL:
[
  {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": "Please analyze this document"
      },
      {
        "type": "document",
        "source": {
          "type": "url",
          "url": "https://example.com/document.pdf"
        }
      }
    ]
  }
]
Example with base64:
[
  {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": "Please analyze this document"
      },
      {
        "type": "document",
        "source": {
          "type": "base64",
          "media_type": "application/pdf",
          "data": "JVBERi0xLjQKJeLjz9MK..."
        }
      }
    ]
  }
]
max_tokens
integer
default:"1024"
required
The maximum number of tokens to generate before stopping
temperature
number
default:"1.0"
Amount of randomness injected into the response. Ranges from 0.0 to 1.0
top_p
number
default:"1.0"
Use nucleus sampling. Ranges from 0.0 to 1.0
top_k
integer
default:"null"
Only sample from the top K options for each subsequent token
stream
boolean
default:"false"
Whether to incrementally stream the response using server-sent events
stop_sequences
array
Custom text sequences that will cause the model to stop generating

Request Example

curl -X POST "https://gptproto.com/v1/messages" \
  -H "Authorization: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "claude-sonnet-4-20250514",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Please analyze this PDF document and provide a summary of its content"
        },
        {
          "type": "document",
          "source": {
            "type": "url",
            "url": "https://www.bt.cn/data/api-doc.pdf"
          }
        }
      ]
    }
  ]
}'

Response

Success
200
Successful response with Anthropic format
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "# Document Analysis Summary\n\n## Key Information:\n- Document Type: Technical API Documentation\n- Total Pages: 35\n- Version: 2.0\n\n## Main Topics:\n1. **Authentication**: The API uses Bearer token authentication with API keys\n2. **Endpoints**: Contains 12 main API endpoints for different operations\n3. **Rate Limiting**: Implements tiered rate limiting based on subscription level\n4. **Error Handling**: Comprehensive error codes and handling strategies\n\n## Key Sections:\n\n### Getting Started\n- Quick start guide for new developers\n- Authentication setup instructions\n- First API call examples in multiple languages\n\n### API Reference\n- Detailed endpoint documentation\n- Request/response formats\n- Parameter descriptions and constraints\n\n### Best Practices\n- Recommended usage patterns\n- Performance optimization tips\n- Security considerations\n\n### Code Examples\n- Python, JavaScript, Go, and cURL examples\n- Common use case implementations\n- Error handling patterns\n\n## Important Notes:\n- All requests must include valid API key\n- Rate limits: 100 requests/minute for free tier, 1000/minute for premium\n- Support for both JSON and XML response formats\n- Webhook notifications available for asynchronous operations"
    }
  ],
  "model": "claude-sonnet-4-20250514",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 3520,
    "output_tokens": 285
  }
}

Error Responses

{
  "error": {
    "type": "authentication_error",
    "message": "Invalid API key"
  }
}