Skip to Content
AgentsBYOK (Bring Your Own Key)

BYOK · Bring Your Own Key

Every buddy (orchestrator included) can route through your own Anthropic or OpenAI account instead of Waypath’s metered billing. The setting is per-buddy, so you can keep the orchestrator on Metered while running Campaign on BYOK Claude, or whatever combination fits your cost model.

Three modes

ModeBillingProvider
MeteredWaypath ai_tokens meter via StripeWaypath-managed Claude
BYOK ClaudeYour Anthropic accountclaude-* family
BYOK OpenAIYour OpenAI accountgpt-* family; same agent contract, different backend

Default is Metered if unset. BYOK sessions skip Waypath’s Stripe ai_tokens meter but still trace to Langfuse for debugging.

Setup

1 · Generate a provider API key

2 · Configure the key in Waypath

Open Settings → Integrations and scroll to LLM Providers. Paste your key into the Claude or OpenAI field and click Save. Waypath validates each key with a free GET /v1/models probe before accepting it.

Under the hood:

POST /api/integrations/claude/configure Content-Type: application/json Authorization: Bearer <token> { "apiKey": "sk-ant-..." }
POST /api/integrations/openai/configure Content-Type: application/json Authorization: Bearer <token> { "apiKey": "sk-..." }

Either endpoint returns { "status": "configured", "provider": "<claude|openai>" } on success or 401 Invalid <provider> key on bad credentials.

3 · Route each buddy

Open Settings → Buddies and set the model mode for each buddy you want on BYOK. The setting persists in localStorage at wp-buddy-models-{wsId} and is sent on every chat request.

Revoke

DELETE /api/integrations/claude # or /api/integrations/openai Authorization: Bearer <token>

This clears the stored key and removes the provider from the connected platforms list. Any buddy currently routed through that provider falls back to Metered on the next turn.

Resolution order

resolveModelForBuddy() (in packages/server/src/agents/model-resolver.ts) picks the active provider + key per request. Order:

  1. Per-buddy client override: what the user picked in Settings → Buddies
  2. Workspace-level BYOK config: the key stored via /configure
  3. Env fallback. ANTHROPIC_API_KEY on the server (Metered)

A missing BYOK key silently falls back to Metered and logs a warning on the server. No client-facing error. The turn succeeds, it just bills to Waypath.

What changes under BYOK

BehaviorMeteredBYOK
Token costBilled to your Waypath plan’s ai_tokens meterBilled to your provider account
Langfuse traceYesYes
Agent contractIdenticalIdentical (OpenAI adapter yields the same SSE shape)
Tool allowlistIdentical (per-buddy)Identical (per-buddy)
DelegationIdenticalIdentical

Which model is used?

resolveModelForBuddy() returns a modelId alongside the key:

  • Metered → claude-sonnet-4-6 (Waypath-managed)
  • BYOK Claude → claude-sonnet-4-6 (your account)
  • BYOK OpenAI → gpt-* family, selected to match the capabilities needed by the buddy’s tools

The modelId is captured in the Langfuse generation span + persisted on each agent_sessions row so you can audit which model ran which turn.


SYNC · OK© 2026 WAYPATHBUILD · D-03SOC2 · IN PROGRESSWAYPATH.APP