Torrix Python SDK
Torrix is a self-hosted LLM observability platform. This SDK wraps your OpenAI and Anthropic clients to log every call automatically. Tokens, cost, latency, and full prompt traces go straight to your dashboard.
Installation
pip install torrix
Quick start
import torrix
from openai import OpenAI
torrix.init(api_key="trxk_...", base_url="http://localhost:8088")
client = torrix.wrap(OpenAI(api_key="sk-..."))
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)
Anthropic
from anthropic import Anthropic
client = torrix.wrap(Anthropic(api_key="sk-ant-..."))
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.content[0].text)
LangChain
from torrix.wrappers.langchain_callback import TorrixCallbackHandler
from langchain_openai import ChatOpenAI
torrix.init(api_key="trxk_...", base_url="http://localhost:8088")
handler = TorrixCallbackHandler()
llm = ChatOpenAI(model="gpt-4o-mini", callbacks=[handler])
response = llm.invoke("What is the capital of France?")
Optional extras
pip install torrix[openai] # pins openai>=1.0
pip install torrix[anthropic] # pins anthropic>=0.20
pip install torrix[all] # both
Running Torrix
curl -o docker-compose.yml https://raw.githubusercontent.com/torrix-ai/install/main/docker-compose.community.yml
docker compose up
Opens at http://localhost:8088. Community edition is free forever.
Links
Metadata
Release files for torrix 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torrix-0.3.0.tar.gz | 9.5 kB | Without provenance | Details for torrix-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torrix-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for torrix-0.3.0-py3-none-any.whl |
Total release size: 22.2 kB
Release files / torrix-0.3.0.tar.gz
| Download URL | torrix-0.3.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f765f890bf86ba8d9e70f67185630363865376bb4b4390cfbcde27d50d860a18
|
|
BLAKE2b-256 checksum How to use checksums |
88e4e52f5acde712950e95772b0a05b9a36f90c203eaae80aefe6c8a4c2ccdb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.4
|
Release files / torrix-0.3.0-py3-none-any.whl
| Download URL | torrix-0.3.0-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0621a9996c1515e8d6be08f8470934df9f4dd973bec88e32a25f6d2497eadba9
|
|
BLAKE2b-256 checksum How to use checksums |
1a5a27f8a93c407aa43bae4960572cb7d9ba1c1081870a505a498faec6986cc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.4
|
Security for torrix 0.3.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.