clever-dinner-74518
10/31/2025, 10:08 AMtall-airline-16756
10/31/2025, 10:08 AMtall-airline-16756
10/31/2025, 10:09 AMcache_system and cache_tools parameters in your LLM configuration. These settings are great because they help reduce token usage by caching system messages and tool definitions, making things more efficient for you.
Here’s a simple example to guide you:
from livekit.plugins.aws import LLM
llm_instance = LLM(
model="anthropic.claude-3-5-sonnet-20240620-v1:0",
cache_system=True,
cache_tools=True
)
When you set cache_system=True, system messages get tagged with a cachePoint in the API request to AWS Bedrock. Likewise, cache_tools=True adds a cachePoint to the last tool in your tool list.
If you want to keep an eye on how caching is working, just check the prompt_cached_tokens field in the response metadata—that shows you how many tokens were pulled from the cache.
Just a quick heads-up: caching works only with certain models, so be sure your chosen model supports this feature. If you have any questions or need a hand setting this up, feel free to ask—I’m here to help!
Sources: livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | tools/main/README.md | Amazon Bedrock LLM plugin guide | LiveKit Docs