跳转到主要内容
POST
POST /v1/messages/count_tokens

授权

Authorization
string
header
必填

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

请求体

application/json
messages
object[]
必填
model
string
必填
cache_control
object | null
context_management
object | null
mcp_servers
object[] | null
output_config
object | null
output_format
object | null
speed
enum<string> | null
可用选项:
standard,
fast
system
thinking
object
tool_choice
object
tools
object[] | null

响应

Successful protocol response

context_management
object | null
必填

Required key; the reference allows null.

input_tokens
integer<int64>
必填