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

Built distribution (wheel)

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

Total release size: 28.4 kB

Release files / torrix_sdk-1.1.1.tar.gz

Download URL torrix_sdk-1.1.1.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
90c885e59979d21ca62cc6b149c4c6a5b20c185b66b2073740e312a8264423ee
BLAKE2b-256 checksum
How to use checksums
587beb4b1721274d68745d7669395b5ffe955b84151cd71c29f2c00d219ca352
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.1-py3-none-any.whl

Download URL torrix_sdk-1.1.1-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dcca95ec6efd053ef15a80676157c59881194570e5b30907d4a200a72918cf8
BLAKE2b-256 checksum
How to use checksums
52342419a15ff4cf4d0ae0d84ef9aaa29854d92ff7aa7bc333ebd866b46705b2
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

Security for torrix-sdk 1.1.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.1.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 11, 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