Skip to main content

ssimplifi — Python SDK for Prism

pip install ssimplifi

Quick start

from ssimplifi import Prism

client = Prism(api_key="prism_sk_...")

response = client.chat.completions.create(
    messages=[{"role": "user", "content": "What's the capital of Australia?"}],
    mode="balanced",
)
print(response.choices[0].message.content)

That's it. The SDK extends the OpenAI Python client, pointed at Prism's base URL. Everything you already know about openai — streaming, retries, response shape — works identically.

Prism-specific kwargs (what you get over plain openai.OpenAI)

Kwarg Header What it does
mode="eco" / "balanced" / "sport" X-Prism-Mode Quality/cost mode for auto-routing
model_prefer="claude-sonnet" X-Prism-Model-Prefer Force a specific model (overrides auto-routing)
session_id="user-abc" X-Prism-Session Multi-turn memory; persists across model switches
cache="off" / "exact" / "semantic" X-Prism-Cache Cache behavior for this request
request_tags={"feature": "search"} X-Prism-Request-Tags Attribution tags for usage breakdown
# Multi-turn chat with session memory
response = client.chat.completions.create(
    messages=[{"role": "user", "content": "Remember: my name is Ravi"}],
    session_id="user-abc",
)
# Next call: no need to resend history
response = client.chat.completions.create(
    messages=[{"role": "user", "content": "What's my name?"}],
    session_id="user-abc",
)
print(response.choices[0].message.content)  # "Your name is Ravi."

Admin methods (Pro/Team tier)

# Live model catalog
catalog = client.models.list(provider="groq")  # filter optional
print(catalog["summary"])  # {"provider_count_active": 7, "model_count_total": 23, ...}

# Your usage
print(client.usage.summary(days=7))

# Cache stats
print(client.cache.stats(days=7))

# API keys
print(client.keys.list())
new = client.keys.create(name="staging-app")
print(new["key"])  # full secret shown ONCE
client.keys.revoke(key_id="key-id-from-list")

# Identity + balance
print(client.whoami())
print(client.balance())

Submitting feedback

The chat response includes an X-Prism-Feedback-Id header you can use to submit thumbs / ratings later:

response = client.chat.completions.create(
    messages=[{"role": "user", "content": "..."}],
    mode="balanced",
)

# Pull the feedback id from the response object
feedback_id = response.response.headers.get("X-Prism-Feedback-Id")

# Later (e.g. when the user clicks thumbs up in your UI)
client.submit_feedback(feedback_id=feedback_id, thumb="up")
client.submit_feedback(feedback_id=feedback_id, rating=5, comment="great")

Drop-in replacement for plain OpenAI

If you've already got code using openai.OpenAI, change two lines:

# Before
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

# After
from ssimplifi import Prism
client = Prism(api_key=os.environ["PRISM_API_KEY"])

Every client.chat.completions.create(...) call you wrote continues to work. Add mode= and you've got auto-routing + caching + multi-provider failover, no code rewrite.

Compatibility

  • Python 3.10+
  • Builds on top of openai>=1.40,<2.0 and httpx>=0.27
  • Tied to the Prism backend /v1/ major version — SDK 1.x works with any backend 1.x.

License

Apache-2.0

Metadata

Release files for ssimplifi 1.8.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 ssimplifi 1.8.0
File Size Uploaded Provenance Actions
ssimplifi-1.8.0.tar.gz 6.5 kB Without provenance Details for ssimplifi-1.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 13.2 kB

Release files / ssimplifi-1.8.0.tar.gz

Download URL ssimplifi-1.8.0.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
830307dac5276a67eb3921e1c081c73e206cf6352ae1369d429a99e21d0b44a4
BLAKE2b-256 checksum
How to use checksums
2c648d392d87c42a2a503c61197c168b091f943a54dc81731cbc74d46dab89ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / ssimplifi-1.8.0-py3-none-any.whl

Download URL ssimplifi-1.8.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f8a4d4d933bf304e82e672f9005cc098c5352c018a8a04607defcddbba59c36
BLAKE2b-256 checksum
How to use checksums
151119d9d3ea8c16989e8eabec91bd5f9b4d77ed6d7844c95dc904ce0a0ae74f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for ssimplifi 1.8.0

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.

Release history Release notifications | RSS feed

This release

1.8.0 This release

2 release files No provenance

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