@cortexkit/pi-anthropic-auth 1.17.0 → 1.18.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.
package/README.md CHANGED
@@ -76,7 +76,7 @@ The sidecar uses the same JSON shape as the OpenCode package, including `routing
76
76
  /claude-quota
77
77
  ```
78
78
 
79
- `/claude-quota` reports sidecar OAuth fallback quota state from `~/.pi/agent/anthropic-auth.json`. `/claude-routing fallback-first` prefers usable OAuth fallback accounts before the main account; `/claude-routing main-first` restores the default. `/claude-routing sticky-balanced` assigns each Pi session to an OAuth account according to current 5-hour, 7-day, and matching model-scoped quota headroom, then persists that assignment across transient failures and process restarts. `/claude-routing reset` clears the current Pi session's assignment. Direct Opus sessions prefer usable accounts whose Fable quota is exhausted. API-key routes use the same sidecar shape as OpenCode and are sent directly to their configured Anthropic-compatible base URL, such as Kie's `https://api.kie.ai/claude`, but Pi only uses them after the main OAuth model response reports HTTP 429 or a streaming rate-limit error and a live quota check confirms 0% remaining. `/claude-cachekeep always` keeps active hybrid caches warm while Pi remains open; `/claude-cachekeep HH-HH` limits prewarms to a local time window. Both send `max_tokens: 0` pre-warm requests about five minutes before the 1-hour TTL expires. Running `/claude-cachekeep` without arguments lists live tracked sessions across Pi processes through a temporary lease registry that stores only session IDs and cache timing. `/claude-fast on` adds Anthropic `speed: "fast"` plus the `fast-mode-2026-02-01` beta header for supported Opus models (`claude-opus-4-6`, `claude-opus-4-7`, and `claude-opus-4-8`).
79
+ `/claude-quota` reports sidecar OAuth fallback quota state from `~/.pi/agent/anthropic-auth.json`. `/claude-routing fallback-first` prefers usable OAuth fallback accounts before the main account; `/claude-routing main-first` restores the default. `/claude-routing sticky-balanced` assigns each Pi session to an OAuth account according to current 5-hour, 7-day, and matching model-scoped quota headroom, then persists that assignment across transient failures and process restarts. `/claude-routing reset` clears the current Pi session's assignment. Direct Opus sessions prefer usable accounts whose Fable quota is exhausted. API-key routes use the same sidecar shape as OpenCode and are sent directly to their configured Anthropic-compatible base URL, such as Kie's `https://api.kie.ai/claude`, but Pi only uses them after the main OAuth model response reports HTTP 429 or a streaming rate-limit error and a live quota check confirms 0% remaining. `/claude-cachekeep always` keeps active hybrid caches warm while Pi remains open; `/claude-cachekeep HH-HH` limits prewarms to a local time window. Both send `max_tokens: 0` pre-warm requests about five minutes before the 1-hour TTL expires. Running `/claude-cachekeep` without arguments lists live tracked sessions across Pi processes through a temporary lease registry that stores only session IDs and cache timing. `/claude-fast on` adds Anthropic `speed: "fast"` plus the `fast-mode-2026-02-01` beta header for supported Opus models (`claude-opus-4-6`, `claude-opus-4-7`, `claude-opus-4-8`, and `claude-opus-5`).
80
80
 
81
81
  ## Relay
82
82
 
package/dist/convert.js CHANGED
@@ -1,4 +1,4 @@
1
- import { applyClaudeCodeMetadata, buildBillingHeaderValue, CLAUDE_CODE_ENTRYPOINT, CLAUDE_CODE_IDENTITY, CLAUDE_FABLE_MYTHOS_5_SUMMARIZED_THINKING, CLAUDE_SONNET_5_ADAPTIVE_THINKING, isClaudeFableOrMythos5Model, isClaudeSonnet5Model, isFastModeSupportedModel, isOpenAIReasoningSignature, orderClaudeCodeBody, signRequestBody, } from '@cortexkit/anthropic-auth-core';
1
+ import { applyClaudeCodeMetadata, buildBillingHeaderValue, CLAUDE_CODE_ENTRYPOINT, CLAUDE_CODE_IDENTITY, CLAUDE_FABLE_MYTHOS_5_SUMMARIZED_THINKING, CLAUDE_OPUS_5_ADAPTIVE_THINKING, CLAUDE_SONNET_5_ADAPTIVE_THINKING, isClaudeFableOrMythos5Model, isClaudeOpus5Model, isClaudeSonnet5Model, isFastModeSupportedModel, isOpenAIReasoningSignature, orderClaudeCodeBody, signRequestBody, } from '@cortexkit/anthropic-auth-core';
2
2
  const CLAUDE_CODE_TOOLS = new Map([
3
3
  'Read',
4
4
  'Write',
@@ -313,18 +313,25 @@ export async function buildAnthropicRequest(modelId, context, options, cache, fa
313
313
  }
314
314
  const isFableOrMythos5 = isClaudeFableOrMythos5Model(modelId);
315
315
  const isSonnet5 = isClaudeSonnet5Model(modelId);
316
- // Sonnet 5 shares Fable/Mythos's adaptive-summarized contract: make adaptive
317
- // thinking visible (display defaults to "omitted") and map reasoning to
318
- // output_config effort. Pi's typed options cannot express thinking-disabled,
319
- // so there is no disable case here (see transform.ts for the raw-body path).
316
+ const isOpus5 = isClaudeOpus5Model(modelId);
317
+ // Sonnet 5 and Opus 5 share Fable/Mythos's adaptive-summarized contract: make
318
+ // adaptive thinking visible (display defaults to "omitted") and map reasoning
319
+ // to output_config effort. Pi's typed options cannot express
320
+ // thinking-disabled, so there is no disable case here (see transform.ts for
321
+ // the raw-body path). Each model refs its own per-family constant —
322
+ // families can diverge, so the constant rather than a shared alias keeps
323
+ // the call sites explicit.
320
324
  if (isFableOrMythos5) {
321
325
  body.thinking = { ...CLAUDE_FABLE_MYTHOS_5_SUMMARIZED_THINKING };
322
326
  }
323
327
  else if (isSonnet5) {
324
328
  body.thinking = { ...CLAUDE_SONNET_5_ADAPTIVE_THINKING };
325
329
  }
330
+ else if (isOpus5) {
331
+ body.thinking = { ...CLAUDE_OPUS_5_ADAPTIVE_THINKING };
332
+ }
326
333
  if (options?.reasoning) {
327
- if (isFableOrMythos5 || isSonnet5) {
334
+ if (isFableOrMythos5 || isSonnet5 || isOpus5) {
328
335
  body.output_config = { effort: options.reasoning };
329
336
  }
330
337
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-anthropic-auth",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -36,7 +36,7 @@
36
36
  "prepublishOnly": "bun run build"
37
37
  },
38
38
  "dependencies": {
39
- "@cortexkit/anthropic-auth-core": "1.17.0"
39
+ "@cortexkit/anthropic-auth-core": "1.18.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@earendil-works/pi-ai": "*",