Anthropic integration
Count tokens (Anthropic format)
POST
/anthropic/v1/messages/count_tokensCounts the number of tokens in a message request.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "http://localhost:8080/anthropic/v1/messages/count_tokens" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-3-opus-20240229", "max_tokens": 0, "messages": [ { "role": "user", "content": "string" } ] }'{
"input_tokens": 0
}{
"type": "error",
"error": {
"type": "string",
"message": "string"
}
}{
"type": "error",
"error": {
"type": "string",
"message": "string"
}
}