TOONX — TOON Token & Cost Analyzer for LLMs TOONX is a Visual Studio Code extension that introduces TOON, a lightweight domain-specific language for describing Large Language Model (LLM) usage, and provides real-time validation, token analysis, and cost estimation directly inside the editor. Designed for developers, architects, and AI engineers who want clarity, correctness, and cost awareness when working with LLM prompts. ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ ✨ Key Features • Custom TOON Language Support • .toon file recognition • Syntax highlighting • Language auto-detection • Real-time Diagnostics • Required field validation (model, prompt, tokens) • Duplicate key detection • Invalid value checks • Inline error reporting using VS Code diagnostics • Token & Cost Analysis • Model-aware pricing engine • Accurate token parsing • Estimated cost calculation based on selected LLM • Status Bar Integration • Live token count • Real-time cost estimate • Updates automatically as you edit • Command Palette Support • TOON: Analyze current file • On-demand analysis for the active TOON document ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 📄 Example TOON File model "gpt-5.2" prompt "Summarize quarterly sales performance" tokens 1200 TOONX will: • Validate the file structure • Highlight syntax errors • Show estimated token usage and cost in the status bar ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 🧠 How TOONX Works 1. Language Layer • Registers .toon as a first-class language in VS Code • Uses a TextMate grammar for syntax highlighting 2. Parser Engine • Parses TOON documents into a structured object model • Extracts model, prompt, token count, and metadata 3. Diagnostics Engine • Converts parser issues into VS Code diagnostics • Highlights errors inline with precise ranges 4. Cost Engine • Maps models to pricing profiles • Computes estimated cost from token usage 5. Status Bar Runtime • Displays live insights without interrupting workflow ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 🚀 Getting Started Install from Marketplace Search for TOONX in the VS Code Extensions Marketplace or visit: https://marketplace.visualstudio.com/items?itemName=jayeshkhushalani.toonx ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ ⌨ Commands Command Description TOON: Analyze current file Analyzes the active .toon file ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 📦 Supported Models TOONX includes extensible pricing profiles and can be expanded to support additional LLMs. (Currently supports configured models via the pricing engine.) ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 🔧 Configuration No configuration required. TOONX activates automatically when a .toon file is opened. ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 🛠 Development & Versioning • Built with TypeScript • Bundled using esbuild • Follows Semantic Versioning • Source-controlled via GitHub Repository: https://github.com/Jay24102001/TOONX ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 📜 License MIT License (recommended for open-source usage) ⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻⸻ 👤 Author Jayesh Khushalani Software Engineer | LLM & Tooling Enthusiast |