OpenAPI 3.1.02026-08-226994571.1 MB

1e929292ddd5

llm utils

Token Counter

Args: request: TokenCountRequest call_endpoint: bool - When set to "True" it will call the token counting endpoint - e.g Anthropic or Google AI Studio Token Counting APIs.

Returns: TokenCountResponse

post/utils/token_counter

Query parameters

call_endpointboolean

Request body

modelstring required
promptstring nullable
messagesobject[] nullable
contentsobject[] nullable
toolsobject[] nullable
{"stackTrail":"components:schemas:TokenCountRequest:properties:system:anyOf","oasType":"schema","type":"unknown","title":"System","nullable":true}

Response

Successful Response

total_tokensinteger required
request_modelstring required
model_usedstring required
tokenizer_typestring required
original_responseobject nullable
errorboolean
error_messagestring nullable
status_codeinteger nullable