Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

⚠️ Status: Development paused.

Rheonic was built as an LLM API layer for cost control and observability in agentic workflows.

The project is currently paused after initial validation attempts. The system is fully functional, but did not reach product-market fit. The hosted service is no longer active. Maintenance has been discontinued for this SDK.

Rheonic Python SDK

Rheonic captures provider telemetry and applies protect preflight decisions before provider calls.

Install

pip install rheonic-sdk --pre

Required environment variables

RHEONIC_INGEST_KEY=<your_project_ingest_key>
RHEONIC_BASE_URL=<value_shown_in_dashboard>

Instrument provider calls

Wrap your provider SDK once.

Telemetry is captured automatically after each provider call.

Enforcement follows Project mode in the dashboard (Observe / Protect).

OpenAI:

import json
import os
from openai import OpenAI
from rheonic import create_client, instrument_openai, RHEONICBlockedError

rheonic = create_client(
    base_url=os.environ["RHEONIC_BASE_URL"],
    ingest_key=os.environ["RHEONIC_INGEST_KEY"],
)
openai_client = instrument_openai(
    OpenAI(api_key=os.environ["OPENAI_API_KEY"]),
    client=rheonic,
    endpoint="/chat/completions",
    feature="assistant",
)

try:
    openai_client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": "hello"}],
        max_tokens=256,
    )
except RHEONICBlockedError as error:
    print(json.dumps({
        "reason": error.reason,
        "retry_after_seconds": error.retry_after_seconds,
        "blocked_until": error.blocked_until,
        "trace_id": error.trace_id,
        "request_id": error.request_id,
    }, indent=2))

Anthropic:

import json
import os
from anthropic import Anthropic
from rheonic import create_client, instrument_anthropic, RHEONICBlockedError

rheonic = create_client(
    base_url=os.environ["RHEONIC_BASE_URL"],
    ingest_key=os.environ["RHEONIC_INGEST_KEY"],
)
anthropic_client = instrument_anthropic(
    Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]),
    client=rheonic,
    endpoint="/v1/messages",
    feature="assistant",
)

try:
    anthropic_client.messages.create(
        model="claude-3-5-sonnet-latest",
        max_tokens=256,
        messages=[{"role": "user", "content": "hello"}],
    )
except RHEONICBlockedError as error:
    print(json.dumps({
        "reason": error.reason,
        "retry_after_seconds": error.retry_after_seconds,
        "blocked_until": error.blocked_until,
        "trace_id": error.trace_id,
        "request_id": error.request_id,
    }, indent=2))

Google:

import json
import os
from google import genai
from google.genai import types
from rheonic import create_client, instrument_google, RHEONICBlockedError

rheonic = create_client(
    base_url=os.environ["RHEONIC_BASE_URL"],
    ingest_key=os.environ["RHEONIC_INGEST_KEY"],
)
google_client = instrument_google(
    genai.Client(api_key=os.environ["GOOGLE_API_KEY"]),
    client=rheonic,
    endpoint="/v1beta/models/generateContent",
    feature="assistant",
)

try:
    google_client.models.generate_content(
        model="gemini-1.5-pro",
        contents="hello",
        config=types.GenerateContentConfig(max_output_tokens=256),
    )
except RHEONICBlockedError as error:
    print(json.dumps({
        "reason": error.reason,
        "retry_after_seconds": error.retry_after_seconds,
        "blocked_until": error.blocked_until,
        "trace_id": error.trace_id,
        "request_id": error.request_id,
    }, indent=2))

RHEONICBlockedError.reason is meant to be operator-relevant. The main values are:

  • tok_cap_breach
  • req_cap_breach
  • cooldown_active
  • fail_closed

If Protect is fail_open, timeout or availability problems stay internal and the provider call continues. If Protect is fail_closed, the SDK raises RHEONICBlockedError with the feedback fields shown above.

Keep one long-lived SDK client per app process. Initialize it during app startup and reuse it for all capture and instrumentation calls so Rheonic can avoid repeated protect cold-start latency.

Optional: custom event capture

Use this only if you can't instrument a provider SDK or need custom events.

import os
from rheonic import create_client, build_event

client = create_client(
    base_url=os.environ["RHEONIC_BASE_URL"],
    ingest_key=os.environ["RHEONIC_INGEST_KEY"],
)

client.capture_event(
    build_event(
        provider="openai",
        model="gpt-4o-mini",
        request={"endpoint": "/chat/completions", "feature": "assistant", "token_explosion_tokens": 64},
        response={"total_tokens": 64, "latency_ms": 120, "http_status": 200},
    )
)

token_explosion_tokens is optional. Set it only for custom/manual events when you want token-explosion detection to use the same request-context signal that the SDK instrumentation sends to both protect and ingest.

Reference

Full quickstart:

  • https://beta.rheonic.dev/quickstart

Support

support@rheonic.dev

Release files for rheonic-sdk 0.1.0b15

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

Source distribution (sdist)

Source distribution for rheonic-sdk 0.1.0b15
File Size Uploaded
rheonic_sdk-0.1.0b15.tar.gz 36.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rheonic-sdk 0.1.0b15
File Interpreter ABI Platform
rheonic_sdk-0.1.0b15-py3-none-any.whl Python 3 none any Details

Total release size: 66.0 kB

Release files / rheonic_sdk-0.1.0b15.tar.gz

Download URL rheonic_sdk-0.1.0b15.tar.gz
Size 36.7 kB
Tags Source
SHA-256 checksum
How to use checksums
41160fc4fad758e6ad9bef9429c8dee7ed923ccc3daa5b48eeb6d601da646ed1
BLAKE2b-256 checksum
How to use checksums
75dea79c8d37df0c320ec48fe6315b96afc06966a0868d1c3d52d3a3d44887a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / rheonic_sdk-0.1.0b15-py3-none-any.whl

Download URL rheonic_sdk-0.1.0b15-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bca140cb7367e1487238a2d3f9555d7791674130a2c644843fb86bafeec34388
BLAKE2b-256 checksum
How to use checksums
98d49b34e50c5f73ac7de98b6f3662a921024d34c214684bbec9aa7e836196c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2
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