runesignal Python SDK
Track, attribute, and reduce AI inference costs — per customer, per feature, per endpoint.
Install
pip install runesignal
Quick start
import runesignal
# Call once at startup
runesignal.configure(api_key="rs_live_YOUR_KEY")
# Decorate any async function that calls an LLM
@runesignal.track(customer_id=user.id, feature_tag="summarize", endpoint_id="POST /summarize")
async def summarize(text: str) -> str:
response = await openai_client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": text}],
)
return response.choices[0].message.content
That's it. RuneSignal captures model, token counts, cost, and latency — then ships the log in the background without blocking your code.
What gets captured
| Field | Source |
|---|---|
model |
response.model |
input_tokens |
response.usage.prompt_tokens |
output_tokens |
response.usage.completion_tokens |
cached_tokens |
response.usage.prompt_tokens_details.cached_tokens |
cost_usd |
Calculated from current pricing table |
latency_ms |
Wall-clock time around your function |
customer_id |
Your parameter |
feature_tag |
Your parameter |
endpoint_id |
Your parameter (defaults to function name) |
Supported providers
Works with any provider that returns an OpenAI-compatible response object (.usage.prompt_tokens, .usage.completion_tokens). Explicitly tested with:
- OpenAI (
openai≥ 1.0) - Anthropic (
anthropic≥ 0.25, returns.usage.input_tokens/.usage.output_tokens) - Google Gemini (via
google-generativeaiwith OpenAI-compat adapter)
Proxy mode (no decorator needed)
Instead of decorating individual functions, you can route all OpenAI calls through the RuneSignal proxy. The proxy forwards requests unchanged and logs in the background:
import openai
import runesignal
runesignal.configure(api_key="rs_live_YOUR_KEY")
client = openai.AsyncOpenAI(
base_url=runesignal.proxy_url(), # https://api.runesignal.com/proxy/openai/v1
api_key="your-openai-key", # still required by the OpenAI SDK
default_headers={"X-Customer-Id": user.id},
)
Safety guarantees
- Never raises — all exceptions inside the SDK are swallowed. Your code path is never affected.
- Never blocks — logs are shipped with
asyncio.create_task(fire-and-forget). - Never stores prompts or completions — only token counts and metadata.
Environment variables
| Variable | Description |
|---|---|
RUNESIGNAL_API_KEY |
Your RuneSignal API key (alternative to configure(api_key=...)) |
RUNESIGNAL_BASE_URL |
Override the ingest endpoint (useful for self-hosted or local dev) |
Pricing table
The SDK ships with a built-in pricing table (runesignal._cost_table.PRICING). It covers all major OpenAI, Anthropic, and Gemini models. Update it by bumping the SDK version or overriding PRICING directly.
License
MIT
Metadata
Release files for runesignal 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| runesignal-0.2.0.tar.gz | 8.5 kB | With provenance | Details for runesignal-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| runesignal-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for runesignal-0.2.0-py3-none-any.whl |
Total release size: 16.5 kB
Release files / runesignal-0.2.0.tar.gz
| Download URL | runesignal-0.2.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63765487907386b77947dac902fdf21893bf29812b02a7b6b9abf76aac5ed4f6
|
|
BLAKE2b-256 checksum How to use checksums |
cae59e8ba3fb144a618f0adb6df26bf9fde7c8a284b245b279d205088ec81417
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 7, 2026.
Transparency logRelease files / runesignal-0.2.0-py3-none-any.whl
| Download URL | runesignal-0.2.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
45affced2378287735e53f56656ac49dc3bb326a8ceccf6e4569a2c55fba0424
|
|
BLAKE2b-256 checksum How to use checksums |
49014f47a89285ea179ee1a1c7a3e973caf04b1637a587c09c850a5e25282a7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 7, 2026.
Transparency logSecurity for runesignal 0.2.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.
Attestation for runesignal-0.2.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 May 7, 2026.
Transparency logA 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.