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

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.1.tar.gz (20.1 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.1-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_cli_token_heimdall-0.1.1.tar.gz
  • Upload date:
  • Size: 20.1 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.1.tar.gz
Algorithm Hash digest
SHA256 dcc61cec133216183bcedd3e0146ce4fb6a6109e636b35d45f0d819eef9635b3
MD5 7954acdcf0e91ebe54b0bb6f18087e6d
BLAKE2b-256 ba5cbcede3aa9143cc8efac565b38e600347403aafff025c17bfd90f09ba0d7c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for llm_cli_token_heimdall-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 865285d0d7eed599e652c11ac50d15e00dfec5a8e4b937da3f48afa70ee4cdab
MD5 ef6ae05bd7ce77f427d99b2882d315df
BLAKE2b-256 85814f5d36321406230da27962d43443865e5a2c9db44d0b4db1379633f15c4c

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