Skip to Content
GatewaysPortkey

Tokenminning with Portkey

Portkey  is an AI gateway for production apps — unified API, fallback chains, budget controls, and observability across 250+ models.

Hub for the Portkey cluster. Best fit for teams needing org-wide caps and config overrides without self-hosting a proxy.

Quick checklist

  1. Open Portkey dashboard → Analytics for spend by model and config.
  2. Set budgets per API key and workspace — budgets.
  3. Configure fallback chains with cheap models first — routing.
  4. Use config overrides to enforce model allowlists per environment.
  5. Export traces for cost attribution — observability.

Typical impact: 50–90% routing routine work to mini-tier; budgets prevent runaway agent loops.

How to reduce Portkey spending

1. Measure first

Portkey Analytics shows requests, tokens, cost, and latency per model, config, and API key.

Observability

2. Cap spend

Set budget limits on API keys and workspaces. Block requests when caps are reached.

Budgets

3. Route cheap

Build fallback chains: haiku/mini first, capable model second. Use config overrides to lock CI keys to cheap tiers.

Model routing

4. Cache prefixes

Portkey supports gateway-level caching for identical requests. Stabilize prefixes for provider-side cache too.

5. Trim upstream bloat

Reduce tool schemas and context in your agent — Context hygiene.

6. Guardrail in prod

Use config overrides for model allowlists. Separate configs for dev, staging, and production.

Budgets

How Portkey bills

Provider rates plus Portkey platform fee. Check current pricing on portkey.ai. BYOK supported for enterprise contracts.

Guides

GuideWhat you’ll learn
BudgetsAPI key budgets, workspace caps
Model routingFallback chains, config overrides
ObservabilityAnalytics, traces, cost attribution

Anti-patterns

Anti-patternWhy it fails
One config for all environmentsCI agents burn prod budget
Unbounded fallback chainEvery failure retries at frontier tier
Portkey + OpenRouter double proxyLatency and fees stack
Last updated on