Gateway Routing
The Prism plugin has two operating modes that control how your Claude API requests are routed. Both modes capture telemetry and run PRISM scoring — the difference is whether requests go straight to Anthropic or pass through the Optra gateway on the way.
The two modes
Section titled “The two modes”Direct mode (enableGateway: false)
Section titled “Direct mode (enableGateway: false)”Your Claude API requests go directly to api.anthropic.com. The plugin still captures telemetry and prompt text in the background — Ingest still receives the data — but there is no Optra hop in the request path.
Gateway mode (enableGateway: true, default)
Section titled “Gateway mode (enableGateway: true, default)”At session start, the plugin writes these env vars into $CLAUDE_ENV_FILE:
ANTHROPIC_BASE_URL=<gateway-url>ANTHROPIC_CUSTOM_HEADERS="X-Gateway-Api-Key: gck_…x-prism-source: claude-code"Claude Code picks them up and routes every API call through the Optra gateway, which forwards to Anthropic. The gateway URL is resolved from a cached config endpoint (24-hour TTL) keyed to your gck_*; you don’t configure URLs by hand.
What each mode gives you today
Section titled “What each mode gives you today”| Direct | Gateway | |
|---|---|---|
| OTEL telemetry + prompt capture | ✓ | ✓ |
| PRISM scoring (Speed / Skill / Efficiency) | ✓ | ✓ |
| In-terminal status line, nudges, alerts | ✓ | ✓ |
All /prism:* commands | ✓ | ✓ |
| Throttle detection | ✓ | ✓ |
| Rightsizing recommendations | ✓ | ✓ |
| Server-side request/response logging | — | ✓ |
| Small extra latency per call | — | one gateway hop |
The only user-visible difference in steady state today is a small per-call latency bump from the extra hop, and the fact that request/response pairs are visible server-side in gateway mode.
Governance — coming soon
Section titled “Governance — coming soon”The gateway is the intended plug-in point for Optra’s governance layer: budget caps, guardrails (DLP, PII, prompt injection, content filtering), and model access control. Those features are under development and are not available yet. Gateway mode doesn’t unlock them today — it just puts your traffic on the path where they will land when they ship.
See Three Pillars → Governance for the planned feature set.
Toggling
Section titled “Toggling”Run /prism:status and say “toggle gateway” (or “switch routing”). The command flips enableGateway in ~/.prism/config.json; restart Claude Code for the change to take effect (the env vars are read at process init).
Or edit the config directly:
{ "enableGateway": false}When to pick each mode
Section titled “When to pick each mode”| Scenario | Recommended |
|---|---|
| Personal use | Either. Direct if you’re sensitive to every millisecond of latency. |
| Preparing a team for governance features | Gateway — so your traffic is already routed by the time the feature ships. |
| Debugging a latency issue | Direct, temporarily, to rule the gateway hop out. |
| Testing the gateway against local Optra services | Gateway — with PRISM_INGEST_URL overridden to localhost for dev. |
Network-restricted environments: both modes require outbound access to the Ingest service and (in gateway mode) to the gateway URL. If you can’t reach either, Prism won’t function. Telemetry-only doesn’t avoid that — it still calls Ingest.