Fenra Python SDK
FinOps platform for AI cost visibility
Usage
Install the package:
pip install fenra
Initialize and start tracking:
import fenra
from openai import OpenAI
fenra.init(api_key="your-fenra-api-key")
# Use as normal - costs are tracked automatically
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
Works with Anthropic (Claude) and Google (Gemini) the same way.
Set context for cost attribution:
fenra.set_context(
billable_customer_id="cust_123", # recommended
environment="production",
feature="chat",
)
For custom providers or manual tracking:
fenra.track(
provider="custom",
model="my-model",
input_tokens=100,
output_tokens=50,
)
To disable auto-tracking:
export FENRA_DISABLE_AUTO_TRACK=1
To enable debug logging:
import logging
logging.getLogger("fenra").setLevel(logging.DEBUG)
Support
Privacy
Fenra is privacy-first by default. No prompts or responses are stored unless explicitly enabled.
License
The Fenra Python SDK is licensed under the Apache 2.0 License.
Release files for fenra 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fenra-0.1.2.tar.gz | 13.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fenra-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.0 kB
Release files / fenra-0.1.2.tar.gz
| Download URL | fenra-0.1.2.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f27fc80ff98e4122f1a34b703447dc07242f49bd1b923d7cd4a4b8c7007c52bf
|
|
BLAKE2b-256 checksum How to use checksums |
fff8091c0e666b6204840024e22e34c6f5107125e31b4d471255d3ac1bde1f7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fenra-0.1.2-py3-none-any.whl
| Download URL | fenra-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93485e05645e790c206753431796d1f0ca40ed9ff4496dd0a202a3e44e540cb7
|
|
BLAKE2b-256 checksum How to use checksums |
3e75f748c3e39ebef87271c87ac38e8fc333f802d0bd51483f6eaf8d970db794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|