#5993·pipecat

LLM 上的 `gen_ai.usage.input_tokens` 会忽略 Anthropic 和 Bedrock 的缓存标记。

作者: wenqiw777创建于 2026年10月1日更新于 2026年10月1日
  1. Install pipecat-ai[Anthropic,tracing].
  2. Run the script below. It builds the usage AnthropicLLMService reports for a turn where the API returned input_tokens=100, cache_creation_input_tokens=300, cache_read_input_tokens=2000 and output_tokens=50, and adds it to a span the way traced_llm does.
  3. Compare gen_ai.usage.input_tokens with the cache attributes.

内容来源: pipecat-ai/pipecat