LLM 上的 `gen_ai.usage.input_tokens` 会忽略 Anthropic 和 Bedrock 的缓存标记。
作者: wenqiw777创建于 2026年10月1日更新于 2026年10月1日
- Install
pipecat-ai[Anthropic,tracing]. - Run the script below. It builds the usage
AnthropicLLMServicereports for a turn where the API returnedinput_tokens=100,cache_creation_input_tokens=300,cache_read_input_tokens=2000andoutput_tokens=50, and adds it to a span the waytraced_llmdoes. - Compare
gen_ai.usage.input_tokenswith the cache attributes.
内容来源: pipecat-ai/pipecat