Skip to main content

estimate_tool_schema_tokens

Function estimate_tool_schema_tokens 

pub fn estimate_tool_schema_tokens(specs: &[ToolSpec]) -> usize
Expand description

Estimate the token cost of native tool definitions serialized into the provider request, using the same ~4 chars/token heuristic as messages. The OpenAI and compatible adapters serialize these schemas into the chat request, so providers that include them in input_tokens report a population of messages plus tool schemas, not messages alone.