Skip to main content

Pendragondi.API Raw

Find out how much you're wasting on redundant API calls — with one decorator and one command.

Pendragondi.API Raw is a local utility that tracks API usage patterns in your Python applications and surfaces hidden inefficiencies like:

  • Repeated identical API calls
  • Missed caching opportunities
  • Wasteful use of expensive services
  • Undetected rate-limit collisions

It runs entirely inside your application. No proxies. No agents. No cloud services. Just insight.


🔍 Why It Exists

Most teams don't track how they're using APIs — they just assume they're used efficiently. But they're not:

  • 💸 Many orgs waste $1000s/month on duplicate API calls
  • 🧱 These inefficiencies compound silently across teams and services
  • 🤖 Observability tools are often too heavy, too late, or too expensive

Pendragondi.API Raw gives you a simple, local way to see your API usage like an engineer and a finance lead — in minutes.


✅ Features

  • 🧠 Detects redundant API calls (same endpoint + args)
  • ❄️ Flags missed caching opportunities
  • 🚦 Surfaces rate-limited behavior (HTTP 429)
  • 💵 Estimates monthly savings potential
  • 📝 Outputs clean, shareable Markdown or JSON reports
  • 🔒 Fully local — no external tracking or data storage

🛠️ Installation

pip install git+https://github.com/PendragonDI/pendragondi-api-raw.git

Or clone and install locally:

git clone https://github.com/PendragonDI/pendragondi-api-raw.git
cd pendragondi-api-raw
pip install -e .

🚀 Quickstart

1. Decorate your API functions:

from pendragondi_api_raw.decorator import log_api_call_decorator
import requests

@log_api_call_decorator(service="openai", cacheable=True)
def call_openai():
    return requests.post("https://api.openai.com/v1/chat/completions", json={"prompt": "Hello"})

2. Run your app as normal.

3. Generate a report:

python -m pendragondi_api_raw.cli --output report.md

4. View the results:

# Pendragondi.API Raw — Optimization Report

Total API Calls: 53
Redundant Calls: 50
Missed Cache Opportunities: 50
Rate Limit Warnings: 0
Estimated Monthly Savings: $0.75

🧪 Examples

See /examples for usage samples for:

  • OpenAI / GPT
  • Stripe
  • REST APIs via requests

🧰 Configuration (optional)

You can control behavior via environment variables:

Variable Description Default
PENDRAGONDI_DB_PATH Path to SQLite log file ~/.pendragondi_api_log.db
PENDRAGONDI_SAMPLE_RATE Percent of calls to log (0–1.0) 1.0
PENDRAGONDI_MASK_FIELDS Comma-separated keys to hide from payload hash Authorization,api_key

📜 License

MIT License


🧭 Why PendragonDI?

Pendragondi.API Raw was built to solve a problem no other tool addressed:
How do I find out how my system is quietly wasting money—before it hits the billing dashboard?

This tool was written by someone who noticed the pattern, proved it, and compressed it into something that can run anywhere.

No agents. No overhead. Just signal.


🤝 Contributing

Contributions are welcome! If you have suggestions for improvements or find a bug, please open an issue or submit a pull request.

When contributing:

  • Fork the repository and create your branch from main.
  • Ensure any new code has appropriate type hints and docstrings.
  • Run the test suite and add tests for new functionality.
  • Submit a descriptive pull request so changes can be reviewed efficiently.
  • Support/Contact: pendragondi@pendragondi.dev

💖 Support the Project

Pendragondi.API Raw is open-source and free to use.
If you’ve found it useful and would like to support ongoing development, you can sponsor us on GitHub:
Sponsor on GitHub

Metadata

Release files for pendragondi-api-raw 1.0.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 pendragondi-api-raw 1.0.0
File Size Uploaded Provenance Actions
pendragondi_api_raw-1.0.0.tar.gz 16.8 kB Without provenance Details for pendragondi_api_raw-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pendragondi-api-raw 1.0.0
File Interpreter ABI Platform Actions
pendragondi_api_raw-1.0.0-py3-none-any.whl Python 3 none any Details for pendragondi_api_raw-1.0.0-py3-none-any.whl

Total release size: 35.6 kB

Release files / pendragondi_api_raw-1.0.0.tar.gz

Download URL pendragondi_api_raw-1.0.0.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
57eba4ec43c919cca743f2cd7871fb75e430467154d02750461911319bb05379
BLAKE2b-256 checksum
How to use checksums
505cfb8fb5bda0e96b563d03efa106df57df6abe359c05fef6a3358d2d47fd87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / pendragondi_api_raw-1.0.0-py3-none-any.whl

Download URL pendragondi_api_raw-1.0.0-py3-none-any.whl
Size 18.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0be46e2df75c97730eb5b6bd3f42b2ef3129970e37de32c6853b65830dadf475
BLAKE2b-256 checksum
How to use checksums
02f2605edeb991c60464d135aca728c6aa5f43bf774337b0d6d9094c5bd75a41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for pendragondi-api-raw 1.0.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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