Skip to main content

Universal AI CLI Proxy, Firewall, and Token Intelligence Gateway

Project description

👁️⚡ LLM Heimdall

PyPI License Status Downloads

Heimdall is the all-seeing Guardian of your API limits. It stands at the gate of your terminal, inspecting every single token trying to cross the bridge to OpenAI, Anthropic, or Google. If a developer unknowingly executes a wildly unoptimized prompt that blows your daily enterprise budget, Heimdall physically slams the gate shut and blocks the network execution.

Heimdall is a local, privacy-first Universal Token Intelligence Gateway. It seamlessly wraps your favorite AI CLIs (claude, gemini, cursor, openai) to act as an interceptor, cache-engine, and cost-firewall.

🔥 Why Run Heimdall?

  1. 🛡️ Enterprise Budget Firewall: Set a hard daily budget (e.g. heimdall config 5.00). If a command costs $5.01, Heimdall aborts the execution before a single penny reaches the cloud.
  2. 🧠 Semantic Prompt Caching: Why pay the LLM for the exact same prompt twice? Heimdall intercepts your prompts locally, hashes them, and returns $0.00 cached hits instantly.
  3. ⚡ Pre-Flight Compression: If Heimdall detects massive files being uploaded to your terminal prompt, it pauses to automatically compress and optimize the text.
  4. 📊 The God-Mode Dashboard: Visualize every penny your machine is spending on tokens broken down by Git Repository (Automatic Project Attribution).

⚡ Installation & Quick Start

Heimdall is deployed via PyPI with zero external database dependencies.

pip install llm-cli-token-heimdall

Or install globally via pipx (Recommended):

pipx install llm-cli-token-heimdall

Install the Magic Shell Guard

Don't worry about remembering heimdall run. Our installer binds Heimdall directly into your terminal automatically.

heimdall init
heimdall install-aliases
source ~/.zshrc

Now, when you type claude "Refactor this module" or gemini "Explain gravity", the all-seeing Heimdall silently steps in to analyze your payload!


💻 Guard Commands

  • heimdall run <tool> <args> - Intercept and track an AI command manually.
  • heimdall dashboard - Launch the central Token UI.
  • heimdall config <limit> - Set your absolute daily dollar firewall limit.
  • heimdall export report.csv --days 30 - Data dump your analytics for management.
  • heimdall update-pricing - Fetch the latest live pricing APIs for accurate cost tracking.

🔌 Expanding with Universal Adapters

Heimdall ships out of the box with auto-detected tracking for:

  • 📝 Anthropic CLI (claude)
  • 🤖 OpenAI / Codex CLIs (gpt, codex, openai)
  • 🔮 Google Gemini CLI (gemini)
  • ...and falls back to robust file-size estimation heuristics for literally any other tool.

Check the Plugin Development Guide to add Heimdall tracking to your proprietary internal enterprise CLIs.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

llm_cli_token_heimdall-0.1.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

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

llm_cli_token_heimdall-0.1.0-py3-none-any.whl (28.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_cli_token_heimdall-0.1.0.tar.gz.

File metadata

  • Download URL: llm_cli_token_heimdall-0.1.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for llm_cli_token_heimdall-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6337241ecaf98257e0d6c3c7ce5442f3054bfd150e85a65866460ea4c9527cac
MD5 3120a66d71c1b48a21f524e0ed06e618
BLAKE2b-256 5ffa5ed469d4cc4a76465ca99849bd59f54bd854d843dbddc28bdcdf091b0dfd

See more details on using hashes here.

File details

Details for the file llm_cli_token_heimdall-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_cli_token_heimdall-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d81a8214884f8d36bccc732c8fb6f8f0723721758d196016d0f2625fdbecb121
MD5 9ce11bd5a44b83f9fd49b0c82874fd1b
BLAKE2b-256 77344b48cf63bbbb6b031ad893c88713cad367fc78585af02f5dc15a0e18ab92

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