@pwguler/pi-pengepul-provider 0.1.0 → 0.2.0

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.
@@ -33,7 +33,7 @@ const DEFAULT_CONTEXT_WINDOW = 200_000
33
33
  const DEFAULT_MAX_TOKENS = 64_000
34
34
  const ZERO_COST: ModelCostRates = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }
35
35
  /** v2 cached pre-multi-catalog lookups (commandcode ids missed reasoning); reject it. */
36
- const MODEL_CACHE_VERSION = 3
36
+ const MODEL_CACHE_VERSION = 4
37
37
 
38
38
  export type ModelInput = ("text" | "image")[]
39
39
 
@@ -269,10 +269,14 @@ export function toProviderModelConfigs(
269
269
  contextWindow: number
270
270
  maxTokens: number
271
271
  thinkingLevelMap?: Record<string, string | null>
272
- compat?: { forceAdaptiveThinking?: boolean }
272
+ compat?: { forceAdaptiveThinking?: boolean; supportsLongCacheRetention?: boolean }
273
273
  }> {
274
274
  return models.map((model) => {
275
275
  const adaptive = model.dialect === "anthropic-messages" && model.reasoning
276
+ // The 1h cache TTL is a Messages-dialect feature: `cache_control.ttl`
277
+ // has nowhere to go on the Chat Completions wire. Reasoning is not part
278
+ // of it — a non-reasoning Claude model caches the same way.
279
+ const longCacheRetention = model.dialect === "anthropic-messages"
276
280
  return {
277
281
  id: model.id,
278
282
  name: model.name,
@@ -297,7 +301,14 @@ export function toProviderModelConfigs(
297
301
  // unsupported so pi omits the thinking param entirely (server default
298
302
  // = adaptive), and forceAdaptiveThinking routes an explicit level to
299
303
  // {type:"adaptive"} + effort instead of budget_tokens.
300
- ...(adaptive ? { compat: { forceAdaptiveThinking: true as const } } : {}),
304
+ ...(adaptive || longCacheRetention
305
+ ? {
306
+ compat: {
307
+ ...(adaptive ? { forceAdaptiveThinking: true as const } : {}),
308
+ ...(longCacheRetention ? { supportsLongCacheRetention: true as const } : {}),
309
+ },
310
+ }
311
+ : {}),
301
312
  }
302
313
  })
303
314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pwguler/pi-pengepul-provider",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "pi custom provider for pengepul, a local relay that pools your Claude/Codex subscriptions. Connects pi to http://127.0.0.1:8317 over the native Anthropic Messages and OpenAI Chat Completions wires.",
6
6
  "license": "MIT",
@@ -9,9 +9,9 @@
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/pwguler/pi-pengepul-provider.git"
11
11
  },
12
- "main": "./src/index.ts",
12
+ "main": "./extensions/index.ts",
13
13
  "files": [
14
- "src",
14
+ "extensions",
15
15
  "README.md",
16
16
  "LICENSE"
17
17
  ],
@@ -24,8 +24,8 @@
24
24
  "provider"
25
25
  ],
26
26
  "peerDependencies": {
27
- "@earendil-works/pi-ai": "*",
28
27
  "@earendil-works/pi-agent-core": "*",
28
+ "@earendil-works/pi-ai": "*",
29
29
  "@earendil-works/pi-coding-agent": "*",
30
30
  "@earendil-works/pi-tui": "*",
31
31
  "typebox": "*"
@@ -39,7 +39,7 @@
39
39
  },
40
40
  "pi": {
41
41
  "extensions": [
42
- "./src/index.ts"
42
+ "./extensions/index.ts"
43
43
  ]
44
44
  },
45
45
  "devDependencies": {
File without changes
File without changes
File without changes
File without changes
File without changes