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.4.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 torrix-sdk 1.4.0
File Size Uploaded Provenance Actions
torrix_sdk-1.4.0.tar.gz 14.4 kB With provenance Details for torrix_sdk-1.4.0.tar.gz

Built distribution (wheel)

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

Total release size: 28.4 kB

Release files / torrix_sdk-1.4.0.tar.gz

Download URL torrix_sdk-1.4.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
411d6335f90c1098de9cff7cc980816269adebc6571f19c4e57adfe64326bd7b
BLAKE2b-256 checksum
How to use checksums
57b6561ea00de948d8bad8d65c8f8ddd39a1a4a5bffe7ab963ca8f81b061b4f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 25, 2026.

Transparency log

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

Download URL torrix_sdk-1.4.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e8a1dddc84b14857322fb28b60fd4f29b4c56bbd4fb1400e30b27ee158bc98a
BLAKE2b-256 checksum
How to use checksums
91589e5a6bc482e23f01b2b56f6e55dca243a05ca1489b8a467bf146ffc1456c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 25, 2026.

Transparency log

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

Full provenance

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

Select from 2 files

Attestation for torrix_sdk-1.4.0.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 25, 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