Skip to content

Expose Claude Sonnet 5 in Pi catalog#118

Open
nodnarbnitram wants to merge 2 commits into
cortexkit:mainfrom
nodnarbnitram:expose-sonnet-5-pi-catalog
Open

Expose Claude Sonnet 5 in Pi catalog#118
nodnarbnitram wants to merge 2 commits into
cortexkit:mainfrom
nodnarbnitram:expose-sonnet-5-pi-catalog

Conversation

@nodnarbnitram

@nodnarbnitram nodnarbnitram commented Jul 8, 2026

Copy link
Copy Markdown

Summary

  • add claude-sonnet-5 to the Pi provider catalog registered by @cortexkit/pi-anthropic-auth
  • add a Pi registration regression test so future request-shaping support cannot ship without model discoverability
  • update the Pi package README catalog sentence

Why

PR #100 added Sonnet 5 request shaping and noted that claude-sonnet-5 is in Pi's native model catalog. The Pi package currently passes a models array to pi.registerProvider('anthropic', ...), which replaces Pi's native Anthropic catalog, so the native Sonnet 5 entry is hidden after this extension loads.

I checked whether omitting models while keeping the CortexKit provider api would preserve native models and still route through the CortexKit transport. A local dummy provider test showed native models keep their anthropic-messages API and bypass the replacement streamSimple, so this PR uses the smaller catalog fix instead of changing the provider override architecture.

Testing

  • bun run --cwd packages/core build && bun run --cwd packages/pi test && bun run test && bun run typecheck
  • bunx biome check .
  • pi --no-extensions -e packages/pi/dist/index.js --list-models claude-sonnet-5

Local Pi output includes:

provider   model              context  max-out  thinking  images
anthropic  claude-sonnet-4-5  200K     64K      yes       yes
anthropic  claude-sonnet-5    1M       128K     yes       yes

Greptile Summary

This PR makes claude-sonnet-5 discoverable in the Pi provider catalog. Because the extension passes an explicit models array to pi.registerProvider, Pi's native Anthropic catalog is replaced entirely, hiding any native Sonnet 5 entry — this change adds it back. The underlying request-shaping support (isClaudeSonnet5Model, CLAUDE_SONNET_5_ADAPTIVE_THINKING, output_config effort routing) was already wired in convert.ts from PR #100.

  • packages/pi/src/index.ts: Adds a claude-sonnet-5 catalog entry with a 1M-token context window, 128K max output, reasoning: true, and introductory pricing ($2/$10 input/output through August 31, 2026). Cache and spec values match Anthropic's published figures.
  • packages/pi/src/tests/index.test.ts: New regression test that mounts a minimal ExtensionAPI mock, calls the extension, and asserts every field on the Sonnet 5 catalog entry — ensuring future model additions cannot silently drop discoverability.
  • packages/pi/README.md: Catalog sentence updated to list Sonnet 5 alongside the existing models.

Confidence Score: 5/5

Safe to merge — the change is a targeted catalog addition backed by request-shaping logic that was already in place, and a regression test validates all catalog fields.

The diff is minimal and focused: one model entry in the catalog, one README sentence, and one new test. The convert.ts layer that handles Sonnet 5 adaptive thinking and output_config routing was already merged; this PR only makes the model visible. All pricing and spec values match Anthropic's published figures.

No files require special attention. The introductory pricing expiration in packages/pi/src/index.ts (and the mirrored assertion in the test) is worth tracking for a follow-up update before September 1, 2026.

Important Files Changed

Filename Overview
packages/pi/src/index.ts Adds the claude-sonnet-5 catalog entry with correct 1M-token context window, 128K max output, and introductory pricing ($2/$10); request-shaping logic (CLAUDE_SONNET_5_ADAPTIVE_THINKING, isClaudeSonnet5Model) was already present from a prior PR.
packages/pi/src/tests/index.test.ts New regression test verifying claude-sonnet-5 is registered in the Pi Anthropic catalog with all expected fields including cost; uses a minimal mock of ExtensionAPI.
packages/pi/README.md Catalog sentence updated to include Claude Sonnet 5; purely documentary, accurate.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Pi as Pi Agent
    participant Ext as cortexKitPiAnthropicAuth
    participant Core as @cortexkit/anthropic-auth-core
    participant API as Anthropic API

    Pi->>Ext: load extension (ExtensionAPI)
    Ext->>Pi: "registerProvider('anthropic', { models: [..., claude-sonnet-5], api, oauth, streamSimple })"
    Note over Pi: Pi catalog now includes claude-sonnet-5

    Pi->>Ext: "streamSimple(model=claude-sonnet-5, context, options)"
    Ext->>Core: isClaudeSonnet5Model(modelId) → true
    Core-->>Ext: "body.thinking = CLAUDE_SONNET_5_ADAPTIVE_THINKING"
    Core-->>Ext: "body.output_config = { effort: options.reasoning }"
    Ext->>API: POST /v1/messages (signed, with adaptive thinking)
    API-->>Ext: SSE stream
    Ext-->>Pi: AssistantMessageEventStream
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Pi as Pi Agent
    participant Ext as cortexKitPiAnthropicAuth
    participant Core as @cortexkit/anthropic-auth-core
    participant API as Anthropic API

    Pi->>Ext: load extension (ExtensionAPI)
    Ext->>Pi: "registerProvider('anthropic', { models: [..., claude-sonnet-5], api, oauth, streamSimple })"
    Note over Pi: Pi catalog now includes claude-sonnet-5

    Pi->>Ext: "streamSimple(model=claude-sonnet-5, context, options)"
    Ext->>Core: isClaudeSonnet5Model(modelId) → true
    Core-->>Ext: "body.thinking = CLAUDE_SONNET_5_ADAPTIVE_THINKING"
    Core-->>Ext: "body.output_config = { effort: options.reasoning }"
    Ext->>API: POST /v1/messages (signed, with adaptive thinking)
    API-->>Ext: SSE stream
    Ext-->>Pi: AssistantMessageEventStream
Loading

Reviews (3): Last reviewed commit: "Assert Sonnet 5 pricing in Pi catalog te..." | Re-trigger Greptile

Comment thread packages/pi/src/tests/index.test.ts

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 3 files

Confidence score: 5/5

  • Safe to merge after the addressed issues were fixed.
Architecture diagram
sequenceDiagram
    participant Ext as Extension Entrypoint
    participant Pi as Pi ExtensionAPI
    participant Catalog as Provider Catalog
    participant User as Pi CLI / User

    Note over Ext,User: NEW: Sonnet 5 registration flow

    Pi->>Ext: load extension (cortexKitPiAnthropicAuth)
    Ext->>Pi: registerProvider('anthropic', { models, oauth, ... })
    Note over Ext,Pi: models array now includes claude-sonnet-5 entry
    Pi->>Catalog: store provider config with model list
    Catalog-->>Pi: acknowledged

    Note over User,Catalog: Model discoverability (after registration)
    User->>Pi: --list-models or model lookup
    Pi->>Catalog: query anthropic models
    Catalog-->>Pi: models including claude-sonnet-5
    Pi-->>User: claude-sonnet-5 listed with 1M context, 128K max

    alt Previously (without PR addition)
        Note over Ext,Pi: Models array omitted claude-sonnet-5
        User->>Pi: --list-models
        Pi-->>User: claude-sonnet-5 not visible (hidden by native catalog replacement)
    end
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/pi/src/tests/index.test.ts
@nodnarbnitram nodnarbnitram force-pushed the expose-sonnet-5-pi-catalog branch from 8a973c1 to ea16ed6 Compare July 8, 2026 21:40
@nodnarbnitram

Copy link
Copy Markdown
Author

Your extension is drawing from overage and not quota on Pi. so I guess this work I did was for nothing. Best of luck. I hope it at least helps you some how 🤷‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant