> ## 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-3-7-Sonnet-All - Web Search - openai

> Claude-3-7-Sonnet-All — Web Search (openai). GPTProto API reference.

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://gptproto.com/v1/chat/completions" \
    -H "Authorization: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "model": "claude-3-7-sonnet-all",
    "messages": [
      {
        "role": "user",
        "content": "What'\''s the weather in NYC?"
      }
    ],
    "tools": [
      {
        "type": "web_search_20250305",
        "name": "web_search",
        "max_uses": 5
      }
    ],
    "stream": false
  }'
  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/v1/chat/completions"
  headers = {
      "Authorization": "YOUR_API_KEY",
      "Content-Type": "application/json"
  }

  data = {
    "model": "claude-3-7-sonnet-all",
    "messages": [
      {
        "role": "user",
        "content": "What's the weather in NYC?"
      }
    ],
    "tools": [
      {
        "type": "web_search_20250305",
        "name": "web_search",
        "max_uses": 5
      }
    ],
    "stream": False
  }

  response = requests.post(url, headers=headers, json=data)
  result = response.json()
  print(json.dumps(result, indent=2))
  ```

  ```javascript JavaScript theme={null}
  const url = "https://gptproto.com/v1/chat/completions";
  const headers = {
    "Authorization": "YOUR_API_KEY",
    "Content-Type": "application/json"
  };

  const data = {
    "model": "claude-3-7-sonnet-all",
    "messages": [
      {
        "role": "user",
        "content": "What's the weather in NYC?"
      }
    ],
    "tools": [
      {
        "type": "web_search_20250305",
        "name": "web_search",
        "max_uses": 5
      }
    ],
    "stream": false
  };

  fetch(url, {
    method: "POST",
    headers: headers,
    body: JSON.stringify(data)
  })
    .then(response => response.json())
    .then(data => console.log(data))
    .catch(error => console.error("Error:", error));
  ```

  ```go Go theme={null}
  package main

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

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

      payload := []byte(`{
  "model": "claude-3-7-sonnet-all",
  "messages": [
  {
  "role": "user",
  "content": "What's the weather in NYC?"
  }
  ],
  "tools": [
  {
  "type": "web_search_20250305",
        "name": "web_search",
  "max_uses": 5
  }
  ],
  "stream": false
  }`)

      req, _ := http.NewRequest("POST", url, bytes.NewBuffer(payload))
      req.Header.Set("Authorization", "YOUR_API_KEY")
      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 signature theme={null}
  {
    "error": {
      "message": "Invalid signature",
      "type": "401"
    }
  }
  ```

  ```json 403 - Insufficient balance theme={null}
  {
    "error": {
      "message": "Insufficient balance",
      "type": "403"
    }
  }
  ```

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

  ```json 503 - Content policy violation theme={null}
  {
    "error": {
      "message": "Input may not meet the guidelines. Please adjust and try again.",
      "type": "503"
    }
  }
  ```
</CodeGroup>

## Parameters

| Parameter     | Type    | Required | Default                                                       | Description                                                                                                   |
| ------------- | ------- | -------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| `model`       | string  | ✅ Yes    | `claude-3-7-sonnet-all`                                       | The model to use for the request                                                                              |
| `messages`    | array   | ✅ Yes    | `[{"role": "user", "content": "What's the weather in NYC?"}]` | Array of message objects for the conversation. Each message must have a role (user or assistant) and content. |
| `tools`       | array   | ✅ Yes    | -                                                             | Array of tool objects. For web search, must include the web\_search tool configuration.                       |
| `stream`      | boolean | ❌ No     | `false`                                                       | Whether to stream the response                                                                                |
| `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                                                                  |
| `max_tokens`  | integer | ❌ No     | -                                                             | The maximum number of tokens to generate before stopping                                                      |
| `stop`        | 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    | `"What's the weather in NYC?"` | The text content when type is `text` |

### Tools Array Structure

For web search functionality, the `tools` array should contain a web search tool object:

| Field             | Type    | Required | Example                                | Description                                                                 |
| ----------------- | ------- | -------- | -------------------------------------- | --------------------------------------------------------------------------- |
| `type`            | string  | ✅ Yes    | `web_search`                           | The type of tool. Must be `web_search` for web search                       |
| `max_uses`        | integer | ❌ No     | `5`                                    | Maximum number of times the web search tool can be used in a single request |
| `allowed_domains` | array   | ❌ No     | `["example.com", "trusteddomain.org"]` | Only include search results from these domains                              |
| `blocked_domains` | array   | ❌ No     | `["untrustedsource.com"]`              | Never include search results from these domains                             |

#### Max Uses

The `max_uses` parameter limits the number of searches performed. If Claude attempts more searches than allowed, the web search result will be an error with the `max_uses_exceeded` error code.

#### Domain Filtering

When using domain filters:

* Domains should not include the HTTP/HTTPS scheme (use `example.com` instead of `https://example.com`)
* Subdomains are automatically included (`example.com` covers `docs.example.com`)
* Specific subdomains restrict results to only that subdomain (`docs.example.com` returns only results from that subdomain, not from `example.com` or `api.example.com`)
* Subpaths are supported (`example.com/blog`)
* You can use either `allowed_domains` or `blocked_domains`, but not both in the same request

#### Complete Tool Configuration Example

```json theme={null}
{
  "type": "web_search_20250305",
      "name": "web_search",
  "max_uses": 5,
  "allowed_domains": ["example.com", "trusteddomain.org"]
}
```
