·llm-caching
</>

llm-caching

rshvr/llm-caching

通过 KV 缓存和提示缓存优化 LLM 成本和延迟。在以下情况下使用:(1) 构造缓存命中的提示,(2) 为 Anthropic/Cohere/OpenAI/Gemini 配置 API cache_control,(3) 使用 vLLM/SGLang/Ollama 设置自托管推理,(4) 构建具有前缀重用的代理工作流程,(5) 设计批处理管道,或 (6) 了解缓存定价和权衡。

2安装·0热度·@rshvr

安装

$npx skills add https://github.com/rshvr/llm-caching --skill llm-caching

SKILL.md

LLMs compute Key (K) and Value (V) vectors for each token during inference. These encode the model's "understanding" of context. Caching avoids recomputation.

Cache hits require the prefix (beginning) to match exactly. Any difference breaks caching for everything after.

| Variable content early | Prefix changes every request | | Randomizing few-shot order | Different order = different prefix | | Timestamps in system prompt | Changes every request | | User ID in prefix | Per-user cache = no sharing | | Prompts < minimum threshold | Too small to cache (1024 tokens for Claude) |

通过 KV 缓存和提示缓存优化 LLM 成本和延迟。在以下情况下使用:(1) 构造缓存命中的提示,(2) 为 Anthropic/Cohere/OpenAI/Gemini 配置 API cache_control,(3) 使用 vLLM/SGLang/Ollama 设置自托管推理,(4) 构建具有前缀重用的代理工作流程,(5) 设计批处理管道,或 (6) 了解缓存定价和权衡。 来源:rshvr/llm-caching。

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/rshvr/llm-caching --skill llm-caching
分类
</>开发工具
认证
收录时间
2026-02-05
更新时间
2026-02-18

快速解答

什么是 llm-caching?

通过 KV 缓存和提示缓存优化 LLM 成本和延迟。在以下情况下使用:(1) 构造缓存命中的提示,(2) 为 Anthropic/Cohere/OpenAI/Gemini 配置 API cache_control,(3) 使用 vLLM/SGLang/Ollama 设置自托管推理,(4) 构建具有前缀重用的代理工作流程,(5) 设计批处理管道,或 (6) 了解缓存定价和权衡。 来源:rshvr/llm-caching。

如何安装 llm-caching?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/rshvr/llm-caching --skill llm-caching 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/rshvr/llm-caching

详情

分类
</>开发工具
来源
skills.sh
收录时间
2026-02-05

相关 Skills

暂无