Count tokens in a Message
Count tokens in a Message
Request body
Example request
{
"messages": [
{
"content": "Count tokens for this input.",
"role": "user"
}
],
"model": "default",
"system": [
{
"text": "You are a tokenizer."
}
],
"thinking": {
"enabled": false
},
"tool_choice": {
"disable_parallel_tool_use": false,
"type": "auto",
"validation_mode": "lazy"
},
"tools": [
{
"description": "Get current weather for a city.",
"inputSchema": {
"properties": {
"city": {
"description": "City name.",
"type": "string"
}
},
"required": [
"city"
],
"type": "object"
},
"name": "get_weather"
}
]
}Response
Successful Response
Changes
Changed in 3 of the 11 revisions of this API.446
- ▲
removed from the
//////request propertyoneOflistrequest-property-one-of-removed
- ▲
removed from the
/////////request propertyoneOflistrequest-property-one-of-removed
- ▲
removed from the
//////////request propertyoneOflistrequest-property-one-of-removed
- ▲
removed from the
/////////////request propertyoneOflistrequest-property-one-of-removed
- ○
added the new optional request property
///new-optional-request-property
- ○
added the new optional request property
///new-optional-request-property
- ○
added to the
///////request propertyanyOflistrequest-property-any-of-added
- ○
added to the
///////////request propertyanyOflistrequest-property-any-of-added
- ○
the request property
////////became optionalrequest-property-became-optional
- ○
the request property
////////became optionalrequest-property-became-optional
- ○
the request property
///////////became optionalrequest-property-became-optional
- ○
the request property
///////////became optionalrequest-property-became-optional
- ○
the request property
////////////became optionalrequest-property-became-optional
- ○
the request property
////////////became optionalrequest-property-became-optional
- ○
the request property
///////////////became optionalrequest-property-became-optional
- ○
the request property
///////////////became optionalrequest-property-became-optional
- ○
the
request property default valuecontentwas addedrequest-property-default-value-added
- ○
the
request property default valuecontentwas addedrequest-property-default-value-added
- ○
the
request property default valuecontentwas addedrequest-property-default-value-added
- ○
the
request property default valuecontentwas addedrequest-property-default-value-added
- ○
the
request property default valuetextwas addedrequest-property-default-value-added
- ○
the
request property default valuetextwas addedrequest-property-default-value-added
- ○
the
request property default valuetextwas addedrequest-property-default-value-added
- ○
the
request property default valuetextwas addedrequest-property-default-value-added
- ○
added
local_resourcediscriminator mapping keys to the////request propertyrequest-property-discriminator-mapping-added
- ○
added
local_resourcediscriminator mapping keys to the////////request propertyrequest-property-discriminator-mapping-added
- ○
mapped value for discriminator key
base64changed from to for//////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
base64changed from to for/////////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
base64changed from to for//////////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
base64changed from to for/////////////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
urlchanged from to for//////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
urlchanged from to for/////////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
urlchanged from to for//////////request propertyrequest-property-discriminator-mapping-changed
- ○
mapped value for discriminator key
urlchanged from to for/////////////request propertyrequest-property-discriminator-mapping-changed
- ○
added to the
//////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
/////////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
//////////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
/////////////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
////////request propertyoneOflistrequest-property-one-of-added
This revision also has 2 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲
- ○
added to the
///////request propertyanyOflistrequest-property-any-of-added
- ○
added to the
///////////request propertyanyOflistrequest-property-any-of-added
- ○
added
mid_conv_systemdiscriminator mapping keys to the////request propertyrequest-property-discriminator-mapping-added
- ○
added
mid_conv_systemdiscriminator mapping keys to the////////request propertyrequest-property-discriminator-mapping-added
- ○
added the new
systemenum value to the request property//request-property-enum-value-added
- ○
added the new
xhighenum value to the request property//request-property-enum-value-added
- ○
added the new
xhighenum value to the request property//request-property-enum-value-added
- ○
added to the
////request propertyoneOflistrequest-property-one-of-added
- ○
added to the
////////request propertyoneOflistrequest-property-one-of-added
- ○
- ○
endpoint added
endpoint-added
This revision also has 13 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ○