Skip to content

Add PAIR_API_KEY shortcut for OpenGovSG PAIR provider - #1

Open
adriangohjw wants to merge 7 commits into
mainfrom
feat/pair-foundry-provider
Open

Add PAIR_API_KEY shortcut for OpenGovSG PAIR provider#1
adriangohjw wants to merge 7 commits into
mainfrom
feat/pair-foundry-provider

Conversation

@adriangohjw

Copy link
Copy Markdown
Collaborator

Summary

  • New PAIR_API_KEY env var expands at CLI startup into ANTHROPIC_AUTH_TOKEN + ANTHROPIC_BASE_URL=https://engine.pair.gov.sg/, mirroring how AI_GATEWAY_API_KEY works today.
  • Runs before applyAiGatewayDefaults so when both keys are set, PAIR wins for Claude traffic and the gateway only fills in the OpenAI side. Explicit ANTHROPIC_* values still take precedence over both.
  • Credential-missing error and docs/configuration.md updated to mention the new shortcut.

Usage

# in .deepsec/.env.local
PAIR_API_KEY=<your pair key>

pnpm deepsec process --project-id <id> --agent claude --model claude-opus-4-6-v1:rsn

Test plan

  • pnpm -r build — typecheck clean
  • pnpm test:unit — 2095 tests passing, including 6 new cases for applyPairDefaults + 1 updated assertion in assertAgentCredential
  • End-to-end: a real process run against PAIR with the key set
  • Sandbox path (pnpm deepsec sandbox process) — not exercised; the firewall should derive engine.pair.gov.sg from the populated ANTHROPIC_UPSTREAM_BASE_URL, but worth verifying before relying on it

🤖 Generated with Claude Code

adriangohjw and others added 7 commits May 11, 2026 22:31
Expands a single PAIR_API_KEY env var into ANTHROPIC_AUTH_TOKEN +
ANTHROPIC_BASE_URL=https://engine.pair.gov.sg/ at CLI startup. Runs
before applyAiGatewayDefaults so PAIR routes Claude traffic while the
gateway fallback handles the OpenAI side. Existing ANTHROPIC_* values
still win.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a fork-clone path that pre-wires PAIR_API_KEY for the Claude Agent
SDK, and updates the AI provider section to list PAIR alongside the
existing AI Gateway shortcut.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Namespaces the env var so it doesn't collide with other tools or shell
profiles that may already use PAIR_API_KEY.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Clone the monorepo without renaming to `.deepsec/` (avoids the
  confusing `.deepsec/.deepsec/` nesting from the self-scan workspace)
- Separate the TypeScript config edit from the .env.local creation
- Show the actual file edit explicitly instead of cramming it into a
  shell comment
- Drop .env.local into `.deepsec/` (where the CLI reads it) rather than
  monorepo root

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds resolveModel() in agent-defaults.ts. When the PAIR env var is in
play, every claude-family run is pinned to claude-opus-4-6-v1:rsn —
the only model id PAIR serves today — and an explicit --model is
ignored with a warning. Codex (different endpoint) is unaffected.

Wired into process, revalidate, triage, sandbox-process, sandbox-all
plus README + configuration.md updates noting that --model is no
longer needed under PAIR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The original comment read as if sonnet might be used for PAIR. It can't
— the two branches are mutually exclusive on isPairActive(). Rewrites
the comment to spell out which path each user lands on.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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