Skip to main content
POST
Anthropic Web Search

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
messages
object[]
必填

Conversation messages, same format as the Anthropic Messages API. The user turn holds your question.

示例:
max_tokens
integer
默认值:1024
必填

Maximum number of tokens to generate in the answer. Required by the upstream Messages API.

示例:

1024

system
string

Optional system prompt to steer the answer's tone or format.

响应

A standard Anthropic Messages response. content[] interleaves the searches performed and the cited answer; usage.server_tool_use.web_search_requests is the billed search count.

id
string
type
string
示例:

"message"

role
string
示例:

"assistant"

stop_reason
string
示例:

"end_turn"

content
object[]

Ordered blocks: server_tool_use (search queries), web_search_tool_result (sources), and text (the cited answer).

usage
object