Count Message Token
Last updated
Was this helpful?
Last updated
Was this helpful?
Model
The model that will complete your prompt.
Messages
Input messages.
Refer to "How to make Messages?" section below this page.
System
System prompt (Optional)
Tools
Definitions of tools that the model may use. (Optional)
Refer to "What is Tools?" below this page.
Tools Choice
How the model should use the provided tools. (Optional)
Refer to "What is Tools Choice?" below this page.
The message content is structured as an array of message objects, and each message follows the format below.
content
Message Content
role
Message Role
user: Represents the message or question sent by the user to the AI—this is the actual input the AI should respond to.
assistant: Represents the AI model’s response to the user’s input.
Definitions of tools that the model may use.
If you include tools
in your API request, the model may return tool_use
content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using tool_result
content blocks.
name
Name of the tool.
description
Optional, but strongly-recommended description of the tool.
input_schema
How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.
auto
Automatically selected by the model based on context
any
Freely select from the provided tools
tool
Force the use of a specific tool only
input_tokens
The total number of tokens across the provided list of messages, system prompt, and tools.
See for additional details and options.
for the tool input
shape that the model will produce in tool_use
output content blocks.