pi-cache-optimizer 2.6.16 → 2.6.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/index.ts +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Pi extension for improving provider-side KV / prompt cache hit rates. It keeps s
|
|
|
32
32
|
- Requests long cache retention when Pi/provider compat supports it.
|
|
33
33
|
- Adds a session-id `prompt_cache_key` fallback for `openai-completions` / `openai-responses` payloads when no effective key exists.
|
|
34
34
|
- Warns once for third-party OpenAI-compatible proxies missing cache/session-affinity compat flags.
|
|
35
|
-
- Detects Anthropic adaptive thinking models (opus-4.6+, sonnet-4.6
|
|
35
|
+
- Detects Anthropic adaptive thinking models (opus-4.6+, sonnet-4.6+ including Sonnet 5, fable-5+) missing `forceAdaptiveThinking: true` compat.
|
|
36
36
|
- Shows restart-persistent provider/model footer stats for supported model families.
|
|
37
37
|
- Supports optional router-extension integration through versioned global protocols (`Symbol.for("pi.routing.registry.v1")` and `Symbol.for("pi.cache.hints.v1")`) without importing router packages.
|
|
38
38
|
|
|
@@ -111,7 +111,7 @@ Notes:
|
|
|
111
111
|
|
|
112
112
|
## Anthropic adaptive thinking models
|
|
113
113
|
|
|
114
|
-
Claude models from opus-4.6 / sonnet-4.6 / fable-5 onwards require `forceAdaptiveThinking: true` in compat. Without it, Pi sends the legacy thinking format and Anthropic rejects the request.
|
|
114
|
+
Claude models from opus-4.6 / sonnet-4.6 (including Sonnet 5) / fable-5 onwards require `forceAdaptiveThinking: true` in compat. Without it, Pi sends the legacy thinking format and Anthropic rejects the request.
|
|
115
115
|
|
|
116
116
|
Pi's built-in catalog already sets this flag for official models. Custom channels in `models.json` that override these models must include the flag:
|
|
117
117
|
|
|
@@ -126,7 +126,7 @@ Pi's built-in catalog already sets this flag for official models. Custom channel
|
|
|
126
126
|
"forceAdaptiveThinking": true
|
|
127
127
|
},
|
|
128
128
|
"models": [
|
|
129
|
-
{ "id": "claude-
|
|
129
|
+
{ "id": "claude-sonnet-5", "name": "Claude Sonnet 5" }
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -140,7 +140,7 @@ Or use model-level override:
|
|
|
140
140
|
"providers": {
|
|
141
141
|
"your-claude-channel": {
|
|
142
142
|
"modelOverrides": {
|
|
143
|
-
"claude-
|
|
143
|
+
"claude-sonnet-5": {
|
|
144
144
|
"compat": {
|
|
145
145
|
"forceAdaptiveThinking": true
|
|
146
146
|
}
|
package/README.zh-CN.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- 在 Pi / provider compat 支持时请求长缓存保留。
|
|
33
33
|
- 对 `openai-completions` / `openai-responses` 请求,在没有有效 key 时使用 Pi session id 补 `prompt_cache_key`。
|
|
34
34
|
- 对缺少缓存 / session-affinity compat 的第三方 OpenAI-compatible 代理给出一次性提醒。
|
|
35
|
-
- 检测 Anthropic adaptive thinking 模型(opus-4.6+、sonnet-4.6
|
|
35
|
+
- 检测 Anthropic adaptive thinking 模型(opus-4.6+、sonnet-4.6+ 含 Sonnet 5、fable-5+)是否缺少 `forceAdaptiveThinking: true` compat。
|
|
36
36
|
- 为支持的模型家族显示可跨 Pi 进程 / 终端重启延续的 provider/model footer 缓存统计。
|
|
37
37
|
- 通过版本化全局协议(`Symbol.for("pi.routing.registry.v1")` 与 `Symbol.for("pi.cache.hints.v1")`)支持可选的 router extension 集成,而不导入任何 router 包。
|
|
38
38
|
|
|
@@ -111,7 +111,7 @@ LiteLLM / OneAPI / NewAPI / 类 OpenRouter 渠道等第三方 `openai-completion
|
|
|
111
111
|
|
|
112
112
|
## Anthropic adaptive thinking 模型
|
|
113
113
|
|
|
114
|
-
Claude 从 opus-4.6 / sonnet-4.6
|
|
114
|
+
Claude 从 opus-4.6 / sonnet-4.6(含 Sonnet 5)/ fable-5 开始需要在 compat 中设置 `forceAdaptiveThinking: true`。缺少此 flag 时,Pi 会发送旧版 thinking 格式,Anthropic 会拒绝请求。
|
|
115
115
|
|
|
116
116
|
Pi 内置 catalog 已为官方模型设置此 flag。`models.json` 中覆盖这些模型的自定义渠道必须包含该 flag:
|
|
117
117
|
|
|
@@ -126,7 +126,7 @@ Pi 内置 catalog 已为官方模型设置此 flag。`models.json` 中覆盖这
|
|
|
126
126
|
"forceAdaptiveThinking": true
|
|
127
127
|
},
|
|
128
128
|
"models": [
|
|
129
|
-
{ "id": "claude-
|
|
129
|
+
{ "id": "claude-sonnet-5", "name": "Claude Sonnet 5" }
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -140,7 +140,7 @@ Pi 内置 catalog 已为官方模型设置此 flag。`models.json` 中覆盖这
|
|
|
140
140
|
"providers": {
|
|
141
141
|
"your-claude-channel": {
|
|
142
142
|
"modelOverrides": {
|
|
143
|
-
"claude-
|
|
143
|
+
"claude-sonnet-5": {
|
|
144
144
|
"compat": {
|
|
145
145
|
"forceAdaptiveThinking": true
|
|
146
146
|
}
|
package/index.ts
CHANGED
|
@@ -1143,14 +1143,14 @@ function isGeminiLikeAssistantMessage(message: unknown, model: PiModel | undefin
|
|
|
1143
1143
|
*
|
|
1144
1144
|
* Adaptive-generation models (from pi-ai built-in catalog) include:
|
|
1145
1145
|
* claude-opus-4-6, claude-opus-4-7, claude-opus-4-8 (also dotted 4.6/4.7/4.8)
|
|
1146
|
-
* claude-sonnet-4-6
|
|
1146
|
+
* claude-sonnet-4-6, claude-sonnet-5
|
|
1147
1147
|
* claude-fable-5
|
|
1148
1148
|
*
|
|
1149
1149
|
* We match broadly: opus >= 4-6, sonnet >= 4-6, fable >= 5.
|
|
1150
1150
|
* Ids may carry date-stamp or size suffixes like "[1M]".
|
|
1151
1151
|
*/
|
|
1152
|
-
const ADAPTIVE_OPUS_PATTERN = /(^|[\/\s:_-])(opus-4[.-][6-9]|opus-4-[1-9][0-9])($|[-_.:\/\s\[])/i;
|
|
1153
|
-
const ADAPTIVE_SONNET_PATTERN = /(^|[\/\s:_-])(sonnet-4[.-][6-9]|sonnet-4-[1-9][0-9])($|[-_.:\/\s\[])/i;
|
|
1152
|
+
const ADAPTIVE_OPUS_PATTERN = /(^|[\/\s:_-])(opus-4[.-][6-9]|opus-4-[1-9][0-9]|opus-([5-9]|[1-9][0-9]))($|[-_.:\/\s\[])/i;
|
|
1153
|
+
const ADAPTIVE_SONNET_PATTERN = /(^|[\/\s:_-])(sonnet-4[.-][6-9]|sonnet-4-[1-9][0-9]|sonnet-([5-9]|[1-9][0-9]))($|[-_.:\/\s\[])/i;
|
|
1154
1154
|
const ADAPTIVE_FABLE_PATTERN = /(^|[\/\s:_-])fable-([5-9]|[1-9][0-9])($|[-_.:\/\s\[])/i;
|
|
1155
1155
|
|
|
1156
1156
|
function isAdaptiveGenerationModel(model: PiModel | undefined): boolean {
|
package/package.json
CHANGED