Skip to main content

PendragonDI API – lightweight tool to detect redundant API call waste, inefficiency, and missed savings in Python apps.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pendragondi_api_raw-1.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pendragondi_api_raw-1.0.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file pendragondi_api_raw-1.0.0.tar.gz.

File metadata

  • Download URL: pendragondi_api_raw-1.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pendragondi_api_raw-1.0.0.tar.gz
Algorithm Hash digest
SHA256 57eba4ec43c919cca743f2cd7871fb75e430467154d02750461911319bb05379
MD5 e7ba4c1b31377879d6029c5c39068b06
BLAKE2b-256 505cfb8fb5bda0e96b563d03efa106df57df6abe359c05fef6a3358d2d47fd87

See more details on using hashes here.

File details

Details for the file pendragondi_api_raw-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pendragondi_api_raw-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0be46e2df75c97730eb5b6bd3f42b2ef3129970e37de32c6853b65830dadf475
MD5 4458f5576efcdb2ce32d65ca13f45508
BLAKE2b-256 02f2605edeb991c60464d135aca728c6aa5f43bf774337b0d6d9094c5bd75a41

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page