Claude-Sonnet-4-5-20250929-Thinking - File Analysis
Claude-Sonnet-4-5-20250929-Thinking — File Analysis. GPTProto API reference.
POST
/
v1
/
messages
claude-sonnet-4-5-20250929-thinking (file analysis)
curl --request POST \
--url https://api.example.com/v1/messagesimport requests
url = "https://api.example.com/v1/messages"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.example.com/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/v1/messages"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/v1/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyClaude’s official format for the file analysis API.
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-5-20250929-thinking",
"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"
}
}
]
}
]
}'
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-5-20250929-thinking",
"max_tokens": 2000,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Please analyze this PDF document and extract the key information, main topics, and summary"
},
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "JVBERi0xLjQKJeLjz9MK..."
}
}
]
}
]
}'
import anthropic
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://gptproto.com"
)
message = client.messages.create(
model="claude-sonnet-4-5-20250929-thinking",
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"
}
}
]
}
]
)
print(message.content)
import anthropic
import base64
client = anthropic.Anthropic(
api_key="YOUR_API_KEY",
base_url="https://gptproto.com"
)
# Read and encode file
with open("document.pdf", "rb") as file:
base64_file = base64.b64encode(file.read()).decode('utf-8')
message = client.messages.create(
model="claude-sonnet-4-5-20250929-thinking",
max_tokens=2000,
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Please analyze this PDF document and extract the key information, main topics, and summary"
},
{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": base64_file
}
}
]
}
]
)
print(message.content)
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://gptproto.com'
});
const message = await client.messages.create({
model: 'claude-sonnet-4-5-20250929-thinking',
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'
}
}
]
}
]
});
console.log(message.content);
import Anthropic from '@anthropic-ai/sdk';
import fs from 'fs';
const client = new Anthropic({
apiKey: 'YOUR_API_KEY',
baseURL: 'https://gptproto.com'
});
// Read and encode file
const base64File = fs.readFileSync('document.pdf').toString('base64');
const message = await client.messages.create({
model: 'claude-sonnet-4-5-20250929-thinking',
max_tokens: 2000,
messages: [
{
role: 'user',
content: [
{
type: 'text',
text: 'Please analyze this PDF document and extract the key information, main topics, and summary'
},
{
type: 'document',
source: {
type: 'base64',
media_type: 'application/pdf',
data: base64File
}
}
]
}
]
});
console.log(message.content);
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://gptproto.com/v1/messages"
payload := []byte(`{
"model": "claude-sonnet-4-5-20250929-thinking",
"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"
}
}
]
}
]
}`)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
req.Header.Set("Authorization", "YOUR_API_KEY")
req.Header.Set("anthropic-version", "2023-06-01")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
package main
import (
"bytes"
"encoding/base64"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
)
func main() {
url := "https://gptproto.com/v1/messages"
// Read and encode file
fileData, _ := os.ReadFile("document.pdf")
base64File := base64.StdEncoding.EncodeToString(fileData)
payload := map[string]interface{}{
"model": "claude-sonnet-4-5-20250929-thinking",
"max_tokens": 2000,
"messages": []map[string]interface{}{
{
"role": "user",
"content": []map[string]interface{}{
{
"type": "text",
"text": "Please analyze this PDF document and extract the key information, main topics, and summary",
},
{
"type": "document",
"source": map[string]interface{}{
"type": "base64",
"media_type": "application/pdf",
"data": base64File,
},
},
},
},
},
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "YOUR_API_KEY")
req.Header.Set("anthropic-version", "2023-06-01")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
{
"error": {
"type": "authentication_error",
"message": "Invalid API key"
}
}
{
"error": {
"type": "invalid_request_error",
"message": "messages: field required"
}
}
{
"error": {
"type": "rate_limit_error",
"message": "Rate limit exceeded"
}
}
{
"error": {
"type": "api_error",
"message": "Internal server error"
}
}
{
"error": {
"type": "overloaded_error",
"message": "Service is temporarily overloaded"
}
}
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
model | string | ✅ Yes | claude-sonnet-4-5-20250929-thinking | The model to use for file analysis |
messages | array | ✅ Yes | - | 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, HTML Maximum file size: 20MB Example with URL: json [ { "role": "user", "content": [ { "type": "text", "text": "Please analyze this document" }, { "type": "document", "source": { "type": "url", "url": "https://example.com/document.pdf" } } ] } ] Example with base64: json [ { "role": "user", "content": [ { "type": "text", "text": "Please analyze this document" }, { "type": "document", "source": { "type": "base64", "media_type": "application/pdf", "data": "JVBERi0xLjQKJeLjz9MK..." } } ] } ] |
max_tokens | integer | ✅ Yes | 1024 | The maximum number of tokens to generate before stopping |
temperature | number | ❌ No | 1.0 | Amount of randomness injected into the response. Ranges from 0.0 to 1.0 |
top_p | number | ❌ No | 1.0 | Use nucleus sampling. Ranges from 0.0 to 1.0 |
top_k | integer | ❌ No | null | Only sample from the top K options for each subsequent token |
stream | boolean | ❌ No | false | Whether to incrementally stream the response using server-sent events |
stop_sequences | array | ❌ No | - | Custom text sequences that will cause the model to stop generating |
Messages Array Structure
Each message object in themessages array should have the following structure:
| Field | Type | Required | Description |
|---|---|---|---|
role | string | ✅ Yes | The role of the message. Can be: user, assistant, or system |
content | array/string | ✅ Yes | The content of the message |
Content Array Structure (when content is an array)
| Field | Type | Required | Example | Description |
|---|---|---|---|---|
type | string | ✅ Yes | text | The type of content |
text | string | ✅ Yes | "The positive prompt for the generation." | The text content when type is text |
⌘I

