Portkey observability
Portkey observability tracks every request through the gateway — model, tokens, cost, latency, and config — for spend attribution and debugging.
Hub: Tokenminning with Portkey.
This page answers portkey analytics, portkey cost tracking, and portkey observability.
Analytics dashboard
Open Portkey → Analytics:
| Metric | Use |
|---|---|
| Cost by model | Find dominant spend slug |
| Cost by config | Attribute per feature or environment |
| Cost by API key | Identify which tool burned the pool |
| Token volume | Input vs output ratio — context bloat signal |
Request traces
Every gateway request generates a trace with:
- Model and provider that served the request
- Input/output token counts
- Latency and status
- Config and override applied
Use traces to debug why a frontier model ran when you expected haiku.
Cost attribution tags
Pass metadata in request headers for feature-level slicing:
response = client.chat.completions.create(
messages=[...],
metadata={"feature": "code-review", "env": "prod"}
)Group Analytics by metadata fields in weekly reviews.
Export and alerting
- Export Analytics data for finance reconciliation
- Set alerts when daily spend exceeds threshold
- Compare week-over-week model mix shifts
Spending guardrails
- Weekly Analytics review — which config moved most?
- Alert on frontier model spike
- Trace one expensive request before blaming the provider
- Attribute by config, not just by API key
Related
Last updated on