Portkey integration
Portkey AI gateway API. Route chat completions and embeddings to any model provider through one OpenAI compatible surface with retries, fallbacks and caching driven by a config, manage the configs and the providers that hold the upstream credentials, store and render versioned prompts and run them, attach user feedback to a trace, read a single request log, and pull cost, request and per model analytics. The control plane and the gateway share one host and one key header, and the key is always sent as x-portkey-api-key.
Say what should happen.
The workflow builds itself.
Common Portkey use cases
- charting daily model spend
- watching traffic after a release
- finding the prompt id to render or run
- correcting a rating after a human review
- finding the provider slug to route a call to
- adding a fallback target to an existing config
- checking which providers a config falls back to
- finding the config slug to route a call through
- checking whether a provider hit its credit limit
- cleaning up configs left behind by an experiment
What you can do with Portkey
Each of these is one operation on one endpoint, available both as a workflow step and as a tool an AI agent can call on its own. Nothing bundles several operations into one action, so what a run did stays readable afterwards.
Most endpoints run on the free plan. A few, mainly the ones that publish on your behalf, need a paid plan.
Config, 5 operations
create_configCreate configPOSTCreates a routing config that gateway calls can then reference by slug.delete_configDelete configDELETEDeletes a routing config.get_configGet configGETReturns the routing rules stored in one config.list_configsList configsGETLists the routing configs of the organization with their slugs and status.update_configUpdate configPUTReplaces the routing rules or the status of a config.
Provider, 4 operations
create_providerCreate providerPOSTCreates a provider that holds an upstream credential and its spend limits.delete_providerDelete providerDELETEDeletes a provider and the routing it enabled.get_providerGet providerGETReturns a provider with its limits and expiry.list_providersList providersGETLists the providers that hold upstream credentials, with their usage and rate limits.
Analytics, 3 operations
get_analytics_by_userGet analytics by userGETReturns request counts and cost grouped by the end user recorded on each call.get_cost_analyticsGet cost analyticsGETReturns cost over time in cents, bucketed, with a total and an average.get_request_analyticsGet request analyticsGETReturns request counts over time, bucketed, with a summary.
Feedback, 2 operations
create_feedbackCreate feedbackPOSTAttaches a scored feedback entry to a trace identifier.update_feedbackUpdate feedbackPUTChanges the value, weight or metadata of an existing feedback entry.
Prompt, 2 operations
list_promptsList promptsGETLists the prompt templates of a workspace with their collection and model.render_promptRender promptPOSTSubstitutes variables into a stored prompt and returns the request that would be sent.
Chat completion, 1 operation
create_chat_completionCreate chat completionPOSTSends a chat completion to any provider through Portkey and returns the OpenAI shaped answer.
Embedding, 1 operation
create_embeddingCreate embeddingPOSTTurns text into embedding vectors through any provider Portkey routes to.
Log, 1 operation
get_logGet logGETReturns the stored request and response of one gateway call.
Model, 1 operation
list_modelsList modelsGETLists the models Portkey can route to, filtered by provider or service.
Prompt completion, 1 operation
run_promptRun promptPOSTFills a stored prompt with variables and sends it to the model in one call.
Use Portkey from Claude Code, Cursor or Codex
Connect Portkey in LiveContext, create an API key in Settings, then add the LiveContext MCP server to your client. Its Portkey operations become tools the client can call, next to every other integration you connected.
claude mcp add --transport http livecontext https://livecontext.ai/mcp --header "X-API-Key: YOUR_API_KEY"[mcp_servers.livecontext]
url = "https://livecontext.ai/mcp"
[mcp_servers.livecontext.http_headers]
"X-API-Key" = "YOUR_API_KEY"{
"mcpServers": {
"livecontext": {
"type": "http",
"url": "https://livecontext.ai/mcp",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}How to connect Portkey
- Create your workspace
Sign up free. Nothing to install.
- Connect Portkey once
Add your Portkey connection in Settings. Every tool from this integration reuses it, and secrets are encrypted at rest and visible only to you.
- Describe the job in chat
The workflow builds itself in front of you and picks the endpoints it needs. Drag the steps yourself on the canvas whenever you would rather be explicit.
Portkey integration FAQ
What can you do with the Portkey integration?
LiveContext exposes 21 operations on Portkey, covering config, provider, analytics and feedback. Common uses include charting daily model spend, watching traffic after a release and finding the prompt id to render or run.
