Terminology crosswalk. Portkey and LangWatch use overlapping names for different concepts (e.g. “virtual key” means different things). The table below is the single source of truth, refer back to it whenever a section feels ambiguous.
Concept mapping at a glance
Code migration: the minimum change
If your current Portkey setup looks like:- No Portkey SDK. LangWatch speaks the OpenAI protocol natively, use any official OpenAI client (Node, Python, Go, Java). Same story for Anthropic:
new Anthropic({ baseURL: "https://gateway.langwatch.ai" })with your VK as theapiKey. virtualKeyheader →apiKeybearer. Portkey carries the VK in a custom header; LangWatch just uses the standard bearer so you don’t need provider-specific plumbing.
Config migration: Portkey Config JSON → LangWatch VK + ModelProviders
A typical Portkey config:
Step 3, create a Virtual Key with the routing policy
From AI Gateway → Routing Policies → New routing policy create a policy whose
modelProviderIds[] is [<openai-id>, <anthropic-id>]. Then from AI Gateway → Virtual Keys → New virtual key:
- Name: whatever you called the Portkey config (e.g.
prod-chat) - Routing policy: the one you just created (or leave unset to use the org default, which orders by
fallbackPriorityGlobalthencreatedAt) - Cache policy:
respect(default, honours Anthropiccache_controlpassthrough) - Optional: attach an existing LangWatch evaluator with
executionMode=AS_GUARDRAILas apreorposthook if you had Portkey guardrails.
X-LangWatch-Cache: force, X-LangWatch-Cache: disable header overrides the VK default per-request. Use force on idempotent eval harnesses to dedupe cost; use disable to bust caches during debugging (equivalent to Portkey’s x-portkey-cache-force-refresh: true).
Step 4, attach a budget
From AI Gateway → Budgets → New budget:
- Scope:
project(ororganizationfor fleet-wide) + target the new project - Window:
month - Limit: your Portkey spend cap
- on_breach:
block(hard-cap, returns 402) orwarn(soft-cap, addsX-LangWatch-Budget-Warningheader)
Rollout pattern: gradual migration without a big-bang
We recommend the following sequence over 2-4 weeks:- Week 1, shadow traffic. Mint a LangWatch VK with
config.shadow_mode: true(v1.1; for v1 just log both upstream responses). Route 1-5% of production traffic through LangWatch alongside Portkey. Compare latency, error rate, and response equality. - Week 2, canary by tenant. Route low-risk tenants (internal users, dev environments) fully through LangWatch. Portkey still carries the majority.
- Week 3, flip customer traffic. Route 50% of customer traffic through LangWatch, with a feature flag that can instantly revert.
- Week 4, decommission Portkey. Once metrics show parity, null out the Portkey integration. Keep the Portkey org active for 30 days in case of rollback; delete after.
/gateway/usage spend + /settings/audit-log (filter Target = virtual_key, budget, etc.) mutation history in parallel to your existing Portkey analytics during the rollout, the LangWatch audit log will show you every VK, budget, provider mutation alongside platform actions, which is especially useful in the cutover period when your ops team is still adjusting governance.
Feature-parity gaps (be explicit)
Some Portkey features don’t have LangWatch v1 equivalents. If any of these are load-bearing for you, weigh them carefully:- Loadbalance strategy (sibling-key rotation for rate-limit absorption), LangWatch v1 routes to one credential per provider slot. Sibling-key loadbalancing is on the v1.1 roadmap. Workaround: if you genuinely need it, keep Portkey for those routes, run LangWatch in parallel for governance.
- Semantic cache: LangWatch v1 ships
respect,force,disablemodes for explicit Anthropic cache_control + a rule engine; semantic similarity lookups are v1.1. - Prompt management embedded in the gateway: LangWatch has a dedicated Prompt Management product surface that’s more powerful than Portkey’s embedded library, but it’s a separate area rather than a subfolder of the gateway.
- Guardrails catalog: Portkey ships a pre-built library of guardrails; LangWatch reuses the evaluator catalog you already have (and any custom evaluator you’ve built). For most enterprise teams this is a net win (you own the logic); for quick-start it’s a cold start.
What to watch during + after migration
- Per-tenant spend: compare your Portkey invoice amount to
sum(GatewayBudgetLedger.amountUsd)on the same time window. First-week variance ≤ 3% is normal (different rounding, model-version timings); > 5% warrants investigation. - p99 latency: LangWatch’s gateway hot path is ~700 ns of gateway-local overhead; upstream provider latency dominates. Compare p99 with + without the gateway (shadow mode is the cleanest A/B). Any regression > 10 ms is worth a ticket.
- 401 rate: during the VK rollout window, any client still hitting Portkey’s endpoint will 404 post-decommission. Set an alert on
gateway_http_requests_total{status="401"}rate spikes to catch stragglers before customer escalations. - Audit log volume: your team will mutate more governance-configuration post-migration (budgets, guardrails, rotation policies). Expect 10-50× more audit rows than Portkey’s minimal audit surface, plan retention accordingly.
See also
- Virtual Keys: the LangWatch VK reference.
- Budgets: hierarchical budget semantics.
- Gateway provider settings: the Advanced (Gateway) tab on each ModelProvider.
- Credential-leak incident response: the “oh no it’s on GitHub” playbook.
- Cache-control rollout: how to roll cache rules to production.