Skip to main content

Torrix Python SDK

Record every OpenAI and Anthropic call your Python app or agent makes in Torrix, the self-hosted observability platform for AI agents. You get the prompt, response, tokens, cost, latency and tool calls of each call, grouped into traces and sessions.

  • No dependencies of its own. Works with sync, async and streaming clients.
  • Sends data in a background thread, so your app is not slowed down.
  • Your data goes only to your own Torrix server.

Install

pip install torrix-sdk

You also need a running Torrix server. The quickest way:

docker run -d --name torrix -p 8088:8088 -v torrix_data:/data gettorrixai/torrix:latest

Open http://localhost:8088, create your account, and copy an API key from Integrations.

Use

The package installs as torrix-sdk and imports as torrix.

import torrix

torrix.init(api_key="trxk_YOUR_KEY", base_url="http://localhost:8088")

That is all. Every call made through the installed openai and anthropic packages is recorded from now on.

Group calls into one turn and name the agent that made them:

with torrix.run_context(session_id="chat-7", agent_name="support-bot"):
    answer = client.chat.completions.create(model="gpt-4o-mini", messages=[...])

Short scripts and serverless functions should call torrix.flush() before they exit.

Learn more

MIT licensed.

Metadata

Release files for torrix-sdk 1.2.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 torrix-sdk 1.2.1
File Size Uploaded Provenance Actions
torrix_sdk-1.2.1.tar.gz 14.5 kB With provenance Details for torrix_sdk-1.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for torrix-sdk 1.2.1
File Interpreter ABI Platform Actions
torrix_sdk-1.2.1-py3-none-any.whl Python 3 none any Details for torrix_sdk-1.2.1-py3-none-any.whl

Total release size: 28.5 kB

Release files / torrix_sdk-1.2.1.tar.gz

Download URL torrix_sdk-1.2.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1a1039053bc4c255e287233be1c14f5ffd12f704b62d355070db7dd608591bf6
BLAKE2b-256 checksum
How to use checksums
db289ee087c8f40151ed43b495ec616da7bd6343360884723f2600f7bd5bbdbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Release files / torrix_sdk-1.2.1-py3-none-any.whl

Download URL torrix_sdk-1.2.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d11a6f56a08d60758029aef37ffcb1eff26bcf4e178165b2f6356b38429f53d
BLAKE2b-256 checksum
How to use checksums
5ad7950cf8943c05cddf8348e7c4c1dbf9dcad89a59cad87b5d13b4d519ecfbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

Security for torrix-sdk 1.2.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for torrix_sdk-1.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 13, 2026.

Transparency log

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