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.3.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 ai-pr-cost-guard 0.3.0
File Size Uploaded Provenance Actions
ai_pr_cost_guard-0.3.0.tar.gz 81.8 kB Without provenance Details for ai_pr_cost_guard-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 152.6 kB

Release files / ai_pr_cost_guard-0.3.0.tar.gz

Download URL ai_pr_cost_guard-0.3.0.tar.gz
Size 81.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6034656de88a39328ed9d9519f8870c390294f24e6d5af38625c13518a5aa3c1
BLAKE2b-256 checksum
How to use checksums
65f067f0f86678c0258355f822b52a1c9501f3becc7721e2fa75cb0fe664b9f3
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.3.0-py3-none-any.whl

Download URL ai_pr_cost_guard-0.3.0-py3-none-any.whl
Size 70.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
033ae216591438a485ad98285b9f0d23d88ab65a09d1447958a101e96c0d71c2
BLAKE2b-256 checksum
How to use checksums
54cf408c887fdaff5d6811348b720eb4f0d3c915e9fa582a808bad8511c4e72e
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.3.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

0.3.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