portkey-ai
Python client library for the Portkey API
Decision gist · record as of 2026-08-14
Yes. Portkey is actively maintained, has no known vulnerabilities, and offers genuine value for production LLM applications—especially if you need failover, load balancing, or observability without refactoring existing code. The MIT License is permissive. Install friction is low. The main prerequisite is a Portkey account and API key.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a Portkey account and API key; virtual keys must be configured in Portkey's dashboard before use.
- Low install friction with a pure-Python wheel and 10 runtime dependencies.
- Actively maintained with a release 22 days ago.
License · maintenance · safety
MIT License (permissive) — MIT License permits commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
last release 2026-07-23 (22 days) · last repo commit 2026-07-23 · 118 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 976,864 downloads/mo, #4,592 on PyPI
Alternatives
Verify before relying
pip install portkey-ai
export PORTKEY_API_KEY=your_key
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="VIRTUAL_KEY"
)
chat_completion = portkey.chat.completions.create(
messages=[{"role": "user", "content": "Say this is a test"}],
model="gpt-4"
)
print(chat_completion)- Whether the 40+ production-critical metrics mentioned in analytics are documented or accessible via the SDK.
- Performance overhead of semantic caching and request tracing relative to direct API calls.
- Support status for providers beyond OpenAI-like implementations (fact sheet lists 'any OpenAI-like provider' but does not enumerate them).
What it is and what it does
Portkey is a Python client for the Portkey API that intercepts calls to OpenAI-compatible LLM providers and adds enterprise features on top. It maintains full API compatibility with the OpenAI SDK pattern, so you can adopt Portkey and immediately gain access to automated failover, load balancing across models, semantic caching, request tracing, and custom metadata tagging—all without rewriting your application logic.
The package is built on httpx, pydantic, and anyio, enabling both sync and async usage patterns. It supports integrations with agent frameworks and offers virtual key management to keep API credentials secure. Observability features include request logging, tracing, feedback collection, and analytics. The SDK is actively maintained and supports Python 3.8 and later.
Use it for
- Route LLM requests across multiple providers or models to reduce latency and cost via load balancing and semantic caching.
- Implement automatic fallback to a secondary model or provider when the primary service is unavailable or slow.
- Monitor and debug LLM application behavior with request tracing, custom metadata, and weighted user feedback.
- Secure API keys by storing them in Portkey's vault and using disposable virtual keys instead of embedding credentials.
- Integrate LLM calls into agent frameworks while retaining Portkey's observability and routing features.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
Portkey is actively maintained, has no known vulnerabilities, and offers genuine value for production LLM applications—especially if you need failover, load balancing, or observability without refactoring existing code. The MIT License is permissive. Install friction is low. The main prerequisite is a Portkey account and API key.
Install
portkey-ai on PyPI
Before you install
Low install friction with a pure-Python wheel and 10 runtime dependencies. Actively maintained with a release 22 days ago.
Requires a Portkey account and API key; virtual keys must be configured in Portkey's dashboard before use.
License in practice
MIT License permits commercial use, modification, and distribution with minimal restrictions—suitable for most projects.
Quickstart
pip install portkey-ai
export PORTKEY_API_KEY=your_key
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY",
virtual_key="VIRTUAL_KEY"
)
chat_completion = portkey.chat.completions.create(
messages=[{"role": "user", "content": "Say this is a test"}],
model="gpt-4"
)
print(chat_completion)
Verify before relying
- Whether the 40+ production-critical metrics mentioned in analytics are documented or accessible via the SDK.
- Performance overhead of semantic caching and request tracing relative to direct API calls.
- Support status for providers beyond OpenAI-like implementations (fact sheet lists 'any OpenAI-like provider' but does not enumerate them).
Package facts
| License | MIT License permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 10 packageshttpxtyping_extensionspydanticanyiodistrosniffiocached-propertytqdmtypes-requestsjiter |
| Maintenance | Actively maintained 22 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 976,864 / month, #4,592 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Operating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: portkey_ai-2.3.4-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “llm failover and load balancing”
- portkey-aiPortkey is a Python SDK that wraps OpenAI-compatible APIs to add…
- litellm-enterpriseLiteLLM Enterprise provides a unified Python SDK and self-hosted AI…
- vllm-routerRoutes and load-balances requests across vLLM worker instances with…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also openinference-instrumentation-portkey · openai · any-llm-sdk · llama-index-llms-openai · litellm-enterprise · openai-chatkit · livekit-plugins-openai · llm-openai-plugin · astra-assistants