Skip to main content

💸 AI PR Cost & Secret Guard (GitHub Action + CLI)

Prevent surprise $5,000 LLM API bills and leaked keys before merge.

Try the live interactive demo on Hugging Face Spaces: 👉 https://huggingface.co/spaces/snsnshnwh/ai-pr-cost-guard

Zero-Install Quickstart (uvx)

Run directly against your repo or staged git changes with uvx — no installation required:

# Scan a directory or file
uvx ai-pr-cost-guard ./src

# Scan staged git changes before committing
uvx ai-pr-cost-guard --git-diff --format text

# Emit a Markdown summary report
uvx ai-pr-cost-guard --git-diff --markdown

GitHub Action

Drop this 6-line GitHub Action into any repository using OpenAI, Anthropic, or Gemini SDKs:

name: AI Cost Guard
on: [pull_request]
jobs:
  cost-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: andrejpimenov122-lab444/ai-pr-cost-guard@v1

Pre-commit Hook

Add to .pre-commit-config.yaml to scan staged Python, TypeScript, and JavaScript files:

repos:
  - repo: https://github.com/andrejpimenov122-lab444/ai-pr-cost-guard
    rev: v0.2.1
    hooks:
      - id: ai-pr-cost-guard

What It Catches

  • COST-001 (HIGH): Exposed OpenAI, Anthropic, and Google Gemini API keys (redacted; including .env and .ipynb outputs).
  • COST-002 (HIGH): LLM SDK calls inside unbounded while/for loops or unbounded retry decorators.
  • COST-003 (MEDIUM): Endpoint-aware missing, invalid, or policy-exceeding output token caps (max_tokens / max_output_tokens).
  • COST-004 (LOW): Missing finite timeout on SDK client or per-request calls.

Local CLI Usage

python3 cost_guard.py ./src

License

MIT

Metadata

Release files for ai-pr-cost-guard 0.2.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 ai-pr-cost-guard 0.2.1
File Size Uploaded Provenance Actions
ai_pr_cost_guard-0.2.1.tar.gz 32.6 kB Without provenance Details for ai_pr_cost_guard-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-pr-cost-guard 0.2.1
File Interpreter ABI Platform Actions
ai_pr_cost_guard-0.2.1-py3-none-any.whl Python 3 none any Details for ai_pr_cost_guard-0.2.1-py3-none-any.whl

Total release size: 61.4 kB

Release files / ai_pr_cost_guard-0.2.1.tar.gz

Download URL ai_pr_cost_guard-0.2.1.tar.gz
Size 32.6 kB
Tags Source
SHA-256 checksum
How to use checksums
46272c237a46c286108618609fd242dbc31a9a32db10e70f7400c28b1d453c31
BLAKE2b-256 checksum
How to use checksums
7ce6784114e09feb69c52694bd1ba7f1532da15dd64974aba1ecb158701a44e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ai_pr_cost_guard-0.2.1-py3-none-any.whl

Download URL ai_pr_cost_guard-0.2.1-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1144e73819be00dce7afe7e56e006755887fed083fb805bca1e41d2f25430dc
BLAKE2b-256 checksum
How to use checksums
6d22a45915c2ab379b8ce2cda0d4f2d0ee88bebb4564f58355c1cbef8c997528
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for ai-pr-cost-guard 0.2.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.

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

0.2.1 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