Skip to main content

Hyperion Python SDK

The official Python partner SDK for the Hyperion AI Gateway. This SDK is a drop-in replacement for the standard openai Python SDK, enhanced with Hyperion's multi-layer caching, smart routing, and observability.

Installation

pip install hyperion-ai

Quick Start

from hyperion import HyperionClient

# HyperionClient extends openai.OpenAI
client = HyperionClient(
    api_key="your-hyperion-key",
    base_url="http://your-gateway:8080/v1"
)

response = client.chat.completions.create(
    model="openai/gpt-5.2",
    messages=[{"role": "user", "content": "How fast is Hyperion?"}],
    # Hyperion-specific controls
    hyperion={
        "bypass_cache": False,
        "tags": ["prod", "onboarding"],
        "route_intent": "high_reasoning"
    }
)

# Access rich metadata
print(f"Cache Status: {response.hyperion.cache_status}")
print(f"Is Hit: {response.hyperion.is_hit}")

Features

  • Zero-Friction Upgrade: Extends openai.OpenAI, inheriting full type parity, streaming support, and tool-call functionality.
  • Smart Caching: Control bypass, TTL, and semantic similarity thresholds per-request.
  • Observability: Every response includes a .hyperion metadata object with performance and cache metrics.
  • Resilience: Inherits OpenAI's robust retry and polling logic.
  • Admin Client: Manage API keys, organizations, and budgets programmatically.

Admin Client

from hyperion import HyperionAdmin

admin = HyperionAdmin(admin_key="your-admin-secret")

# Create a scoped key
key = admin.keys.create(
    name="Test Key",
    budget_limit_usd=10.0,
    allowed_models=["gpt-5.2-mini"]
)

Global Patching

If you can't easily change your client initialization, use hyperion.patch() to redirect all OpenAI traffic:

import openai
import hyperion

hyperion.patch(openai)

# This standard client now routes through Hyperion
client = openai.OpenAI()

Metadata

Release files for hyperion-ai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hyperion-ai 0.1.0
File Size Uploaded
hyperion_ai-0.1.0.tar.gz 10.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hyperion-ai 0.1.0
File Interpreter ABI Platform
hyperion_ai-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / hyperion_ai-0.1.0.tar.gz

Download URL hyperion_ai-0.1.0.tar.gz
Size 10.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3d21232b5a4f821208d326fe1887c5e5dd7a6a7309747def795415cd7506c69a
BLAKE2b-256 checksum
How to use checksums
5e21c8e024785a1100069d2f5a70b578f9e0ffc78825dff3c002481363848b7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / hyperion_ai-0.1.0-py3-none-any.whl

Download URL hyperion_ai-0.1.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b3e7d2b92e3c56549652d0bac50b9537e2b89c376b5e5ab4322f0d5e2ec1a5b
BLAKE2b-256 checksum
How to use checksums
dbe7612a05d9dcb299331e9b390349ea5fd7a4510a96879e2dfb495556d46665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page