> ## Content Index
> Fetch the complete content index at: https://dev.tmlab.store/news/llms.txt
> Use this file to discover other available public pages before exploring further.

# 提示词缓存：把命中率从 20% 提到 85% 的三个改动
- URL: https://dev.tmlab.store/news/cache-prompt/
- Published: 2026-10-03T00:00:00.000Z
- Updated: 2026-10-13T08:55:54.000Z
- Description: 缓存只认前缀。调整消息顺序、固定工具定义的排列、把时间戳移到最后，就能大幅提高命中率。
- Author: Orbis News
- Tags: 实战教程, 把模型接进产品, #orbis-demo

{"version":1,"sourceTitle":"提示词缓存：把命中率从 20% 提到 85% 的三个改动","motif":"prefix","min":7,"demoAuthor":"林叙","models":\["deepseek/deepseek-v4.1-flash","anthropic/claude-sonnet-5.5"\],"order":9,"topicOrder":3,"topicIndex":1}

## 先看结论

- 不变的内容放在最前面。
- 工具定义的顺序每次都要一致。
- 当前时间这类变化的信息放到最后一条消息里。

## 为什么命中率低

很多应用会在系统提示词开头写上当前时间，这让每次请求的前缀都不一样，缓存永远不会命中。

## 三个改动

- 把时间、用户名等变化的信息移到最后一条用户消息里。
- 工具定义按名称排序后再传入。
- 多轮对话只在末尾追加，不修改历史消息。

## 文中提到的模型

模型 ID 可以直接填进 model 参数，在 Orbis 用同一个 API Key 调用。

DeepSeek V4.1 Flash

deepseek/deepseek-v4.1-flash

输入 ¥0.4 / 输出 ¥3.2每百万 tokens

[查看模型](https://dev.tmlab.store/?ref=dev.tmlab.store)

Claude Sonnet 5.5

anthropic/claude-sonnet-5.5

输入 ¥21.6 / 输出 ¥108每百万 tokens

[查看模型](https://dev.tmlab.store/?ref=dev.tmlab.store)