Skip to main content

The official Python SDK for the Hyperion AI Gateway

Project description

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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hyperion_ai-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hyperion_ai-0.1.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file hyperion_ai-0.1.0.tar.gz.

File metadata

  • Download URL: hyperion_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for hyperion_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3d21232b5a4f821208d326fe1887c5e5dd7a6a7309747def795415cd7506c69a
MD5 2245e86fdab34675c0b0d180b6131a50
BLAKE2b-256 5e21c8e024785a1100069d2f5a70b578f9e0ffc78825dff3c002481363848b7b

See more details on using hashes here.

File details

Details for the file hyperion_ai-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hyperion_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for hyperion_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b3e7d2b92e3c56549652d0bac50b9537e2b89c376b5e5ab4322f0d5e2ec1a5b
MD5 a4ffcf302864322a386428df5464ff93
BLAKE2b-256 dbe7612a05d9dcb299331e9b390349ea5fd7a4510a96879e2dfb495556d46665

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page