Skip to main content

👁️⚡ 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. Because it is a standalone CLI application, we strongly recommend using pipx to install it globally without breaking your system's Python packages (avoids PEP 668 errors).

# Recommended global installation
pipx install llm-cli-token-heimdall

(If you know what you are doing and want to install it manually in a specific virtual environment, you can use pip 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.

Metadata

Release files for llm-cli-token-heimdall 0.2.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 llm-cli-token-heimdall 0.2.0
File Size Uploaded Provenance
llm_cli_token_heimdall-0.2.0.tar.gz 20.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-cli-token-heimdall 0.2.0
File Interpreter ABI Platform
llm_cli_token_heimdall-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.2 kB

Release files / llm_cli_token_heimdall-0.2.0.tar.gz

Download URL llm_cli_token_heimdall-0.2.0.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d7ade4eaf0add3f56079a5e7780a46a57387df866f4277a54469b2f4d30ae55a
BLAKE2b-256 checksum
How to use checksums
63e6d7649da6f5e387ee8b2a1109def3dd319e2a5e82a1df7a0c2bfa3a108d2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / llm_cli_token_heimdall-0.2.0-py3-none-any.whl

Download URL llm_cli_token_heimdall-0.2.0-py3-none-any.whl
Size 28.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5cfd19f489c6c5252d57ab4355d2e2807428f5668c85af2e92d3e3ea32a423d8
BLAKE2b-256 checksum
How to use checksums
63c0045e1e6898eea4a48d6908009e962eebb68b47a6d42440cc6d3a9f974c80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Security for llm-cli-token-heimdall 0.2.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.

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