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.1.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.1.0
File Size Uploaded
torrix_sdk-1.1.0.tar.gz 14.5 kB Details

Built distribution (wheel)

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

Total release size: 28.5 kB

Release files / torrix_sdk-1.1.0.tar.gz

Download URL torrix_sdk-1.1.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
06a231a4875d67670c60326018ef5321ccaf28b2865fd829957daa2f0de160ad
BLAKE2b-256 checksum
How to use checksums
9f2ea6fe761f7111bbdd0458fa431cdd78f22befe9d9fd754858f8f4b461ea9e
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 11, 2026.

Transparency log

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

Download URL torrix_sdk-1.1.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c862d8572f7712fb1a0dc295981c54a670f827355594c6cfc43ff92f20dab21
BLAKE2b-256 checksum
How to use checksums
72bb272152c7bbd4381a792c2b08c4b8d67f6942abc6de95d3baa3622f78ae7b
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 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

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