Skip to main content

Zorveus Python SDK (zorveus)

Official Python client library for the Zorveus AI Infrastructure Platform.

See DOCUMENTATION.md for full codebase reference documentation and API details.

Installation

Standard installation:

pip install zorveus

With framework adapters:

# OpenAI SDK integration
pip install zorveus[openai]

# LangChain integration
pip install zorveus[langchain]

# LlamaIndex integration
pip install zorveus[llamaindex]

Environment variables

Variable Description Default
ZORVEUS_INFERENCE_KEY Data Plane inference key (zrv_live_...) None
ZORVEUS_GATEWAY_URL Data Plane API base URL https://api.zorveus.com/v1
ZORVEUS_SERVICE_KEY Control Plane service key (zrv_svc_...) None
ZORVEUS_BASE_URL Control Plane API base URL https://api.zorveus.com

Copy examples/.env.example to .env to configure environment variables.


Usage

1. Data Plane inference client (Zorveus and AsyncZorveus)

Non-streaming chat completion

from zorveus import Zorveus

client = Zorveus(api_key="zrv_live_123...")

response = client.chat.completions.create(
    model="openai/gpt-4.1-mini",
    messages=[{"role": "user", "content": "Explain AI gateways in one sentence."}],
    zorveus_metadata={"external_user_id": "usr_sara_101"}
)
print(response.choices[0].message.content)

SSE streaming completion

from zorveus import Zorveus

client = Zorveus(api_key="zrv_live_123...")

stream = client.chat.completions.create(
    model="openai/gpt-4.1-mini",
    messages=[{"role": "user", "content": "Count from 1 to 5."}],
    stream=True
)

for chunk in stream:
    content = chunk.choices[0].delta.content or ""
    print(content, end="", flush=True)

Async inference client

import asyncio
from zorveus import AsyncZorveus

async def main():
    client = AsyncZorveus(api_key="zrv_live_123...")
    response = await client.chat.completions.create(
        model="openai/gpt-4.1-mini",
        messages=[{"role": "user", "content": "Hello world!"}]
    )
    print(response.choices[0].message.content)
    await client.close()

asyncio.run(main())

Query live spend & allowance

from zorveus import Zorveus

client = Zorveus(api_key="zrv_live_123...")
usage = client.get_usage()

print(f"Spend cap: ${usage.spend_cap}")
print(f"Period spend: ${usage.period_spend}")
print(f"Remaining allowance: ${usage.remaining_allowance}")

2. OpenAI SDK integration (ZorveusOpenAI)

If you prefer using official openai SDK types, install zorveus[openai] and use ZorveusOpenAI:

from zorveus.openai import ZorveusOpenAI

client = ZorveusOpenAI(
    api_key="zrv_live_123...",
    external_user_id="cus_12345",
    display_name="Ada Lovelace",
    email="ada@example.com",
    user_metadata={"plan": "pro", "workspace_id": "workspace_789"}
)

response = client.chat.completions.create(
    model="openai/gpt-4.1-mini",
    messages=[{"role": "user", "content": "Hello from OpenAI wrapper!"}]
)

print(response.choices[0].message.content)

3. Control Plane service client (ZorveusServiceClient)

Provision user profile & grant credits

from zorveus import ZorveusServiceClient

service = ZorveusServiceClient(api_key="zrv_svc_123...")
app_id = "app_startup_123"
external_id = "usr_sara_101"

# 1. Create or update profile
user_res = service.product_users.create_or_update(
    app_id=app_id,
    external_user_id=external_id,
    display_name="Sara Connor",
    email="sara@example.com"
)

# 2. Grant credits with 12-decimal string precision
grant_res = service.product_users.grant_credit_by_external_id(
    app_id=app_id,
    external_user_id=external_id,
    amount="25.000000000000",
    source="promotion",
    reason="Welcome Bonus"
)

print(f"Available balance: ${grant_res.credit_summary.available_credits}")

Register BYOK provider credentials

from zorveus import ZorveusServiceClient

service = ZorveusServiceClient(api_key="zrv_svc_123...")

credential = service.provider_credentials.create(
    app_id="app_startup_123",
    provider="openai",
    api_key="sk-proj-..."
)
print("Credential registered:", credential.provider_credential.id)

4. OAuth 2.0 PKCE flow (ZorveusOAuth)

from zorveus import ZorveusOAuth

# 1. Generate PKCE parameters
pkce = ZorveusOAuth.generate_pkce()

# 2. Build authorization URL
auth_url = ZorveusOAuth.get_authorization_url(
    client_id="zrv_client_123",
    redirect_uri="https://yourapp.com/oauth/callback",
    state=pkce.state,
    code_challenge=pkce.code_challenge
)

# 3. Validate callback URL
validation = ZorveusOAuth.validate_callback(
    "https://yourapp.com/oauth/callback?code=auth_code_123&state=" + pkce.state,
    expected_state=pkce.state
)

# 4. Exchange authorization code for access token
if validation.valid and validation.code:
    token_res = ZorveusOAuth.exchange_token(
        client_id="zrv_client_123",
        code=validation.code,
        code_verifier=pkce.code_verifier,
        redirect_uri="https://yourapp.com/oauth/callback"
    )
    print("Access token:", token_res.access_token)

License

MIT

Metadata

Release files for zorveus 0.4.1

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

Source distribution (sdist)

Source distribution for zorveus 0.4.1
File Size Uploaded Provenance Actions
zorveus-0.4.1.tar.gz 2.4 MB Without provenance Details for zorveus-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for zorveus 0.4.1
File Interpreter ABI Platform Actions
zorveus-0.4.1-py3-none-any.whl Python 3 none any Details for zorveus-0.4.1-py3-none-any.whl

Total release size: 2.4 MB

Release files / zorveus-0.4.1.tar.gz

Download URL zorveus-0.4.1.tar.gz
Size 2.4 MB
Tags Source
SHA-256 checksum
How to use checksums
83bfd41eeb9fa9fd57f697298c75bb73770b2ed45468b599b38d6b8786d6b9cd
BLAKE2b-256 checksum
How to use checksums
30fe1019d5425a1aa90c26d5202edffcc94d1154376181b725af6c9a6fde2afc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / zorveus-0.4.1-py3-none-any.whl

Download URL zorveus-0.4.1-py3-none-any.whl
Size 31.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6b1f61eab346cf893adb7426ca07aa4da8f2cbe6bbd86dede791a0ca45e5713e
BLAKE2b-256 checksum
How to use checksums
e010a79c8c68863f58246738aad9561c8e5c33522fc6d1eda6616f4b040a55c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.22 {"installer":{"name":"uv","version":"0.12.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for zorveus 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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