> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gptproto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude-Opus-4-1-20250805-Thinking - File Analysis

> Claude-Opus-4-1-20250805-Thinking — File Analysis. GPTProto API reference.

Claude's official format for the file analysis API.

<CodeGroup>
  ```bash cURL (with URL) theme={null}
  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-opus-4-1-20250805-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"
            }
          }
        ]
      }
    ]
  }'
  ```

  ```bash cURL (with Base64) theme={null}
  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-opus-4-1-20250805-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..."
            }
          }
        ]
      }
    ]
  }'
  ```

  ```python Python (with URL) theme={null}
  import anthropic

  client = anthropic.Anthropic(
      api_key="YOUR_API_KEY",
      base_url="https://gptproto.com"
  )

  message = client.messages.create(
      model="claude-opus-4-1-20250805-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)
  ```

  ```python Python (with Base64) theme={null}
  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-opus-4-1-20250805-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)
  ```

  ```javascript JavaScript (with URL) theme={null}
  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-opus-4-1-20250805-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);
  ```

  ```javascript JavaScript (with Base64) theme={null}
  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-opus-4-1-20250805-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);
  ```

  ```go Go (with URL) theme={null}
  package main

  import (
      "bytes"
      "encoding/json"
      "fmt"
      "io/ioutil"
      "net/http"
  )

  func main() {
      url := "https://gptproto.com/v1/messages"

      payload := []byte(`{
    "model": "claude-opus-4-1-20250805-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))
  }
  ```

  ```go Go (with Base64) theme={null}
  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-opus-4-1-20250805-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))
  }
  ```
</CodeGroup>

<CodeGroup>
  ```json 401 - Invalid API Key theme={null}
  {
    "error": {
      "type": "authentication_error",
      "message": "Invalid API key"
    }
  }
  ```

  ```json 400 - Invalid Request theme={null}
  {
    "error": {
      "type": "invalid_request_error",
      "message": "messages: field required"
    }
  }
  ```

  ```json 429 - Rate Limit Exceeded theme={null}
  {
    "error": {
      "type": "rate_limit_error",
      "message": "Rate limit exceeded"
    }
  }
  ```

  ```json 500 - Internal Server Error theme={null}
  {
    "error": {
      "type": "api_error",
      "message": "Internal server error"
    }
  }
  ```

  ```json 529 - Overloaded theme={null}
  {
    "error": {
      "type": "overloaded_error",
      "message": "Service is temporarily overloaded"
    }
  }
  ```
</CodeGroup>

## Parameters

| Parameter        | Type    | Required | Default                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ---------------- | ------- | -------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`          | string  | ✅ Yes    | `claude-opus-4-1-20250805-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 the `messages` 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` |
