Sep 26, 2025: AI_COUNT_TOKENS function (Preview)¶
The Snowflake AI_COUNT_TOKENS function helps you size your AI workloads by calculating the total number of input tokens processed by large language models and task-specific functions, so you can size queries appropriately before hitting model limits and accurately estimate costs based on input token usage.
AI_COUNT_TOKENS 的主要功能包括:
Count tokens: Calculate the total number of input tokens for any AI Function, including AI_COMPLETE, AI_EMBED, AI_CLASSIFY, and AI_SENTIMENT. AI_COUNT_TOKENS also takes the specific model into account for functions that can use different models.
获取成本优化见解: 在执行操作前精确计算输入词元数量,帮助您优化提示内容,并在组织范围内合理控制 AI 成本支出。
支持复杂配置: 可分析自定义标签、描述、任务定义及示例等高级功能的影响,从而全面了解 AI 工作流程中的词元使用情况。
有关更多信息,请参阅 AI_COUNT_TOKENS。