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.3.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.3.0
File Size Uploaded Provenance Actions
torrix_sdk-1.3.0.tar.gz 14.4 kB With provenance Details for torrix_sdk-1.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 28.5 kB

Release files / torrix_sdk-1.3.0.tar.gz

Download URL torrix_sdk-1.3.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e3f25c6f1ad533bfc610a59bbbd5c9ca169e9dcf9e9ab05cc1952a0eb487be8c
BLAKE2b-256 checksum
How to use checksums
d890839e30e9762e9b2aaa0faeebf1695b798e23d710ca1f12a91b038875d2b4
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.3.0-py3-none-any.whl

Download URL torrix_sdk-1.3.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2802826d9745e1b60c0de997d2db72a1772a0e55e38c155ff39eabd35fc35112
BLAKE2b-256 checksum
How to use checksums
30b6a9db938132b7b48fe38335eeb06c2a12064b8ac678d19b937b1ab8c77fe2
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.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.

Full provenance

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

Select from 2 files

Attestation for torrix_sdk-1.3.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