Count the exact number of tokens in a text string for a specific AI model.
Uses tiktoken for OpenAI models and estimates for others.
Args:
text: The text to count tokens for
model: The AI model to count tokens for. Options: gpt-4o, gpt-4o-mini,
gpt-4.1, claude-sonnet, claude-haiku, gemini-pro, gemini-flash,
llama-4, deepseek-v3, mistral-large. Default: gpt-4o
Returns:
Token count information including count, context window, and fit status
ConnectorNo auth