{"slug": "how-to-optimize-your-ai-token-usage", "title": "How to optimize your AI token usage", "summary": "A new open-source tool called Repo-Brain compresses entire codebases into a single markdown context file, achieving 96% compression on a 262-file repository by reducing 154,229 tokens to 6,487. The tool uses static analysis, architecture analysis, and semantic relationship mapping to feed code context to any large language model in a single prompt, eliminating the need to re-read repositories during each conversation.", "body_md": "Compress an entire codebase into a single markdown context file.\n\nFeed it to any LLM once instead of re-reading your repo every conversation.\n\nAchieved 96% compression on a 262-file repo (154,229 → 6,487 tokens).\n\n### What's included\n\n**Static analysis**— Tree-sitter AST parsing for Python, JS, TS, Go, Rust;\n\nregex fallback for Java, Ruby, C#, C/C++, Swift, Kotlin, Shell, and more**Architecture analysis**— single LLM call identifies layers, components,\n\nentry points, and data flow**Semantic relationships**— LLM-discovered producer/consumer links,\n\nshared data structures, parallel implementations, and polyglot bridges**Multi-provider support**— OpenAI, Claude, Deepseek, Gemini, Groq, Ollama,\n\nMistral, xAI, Perplexity, OpenRouter**One-liner installers**— no manual venv or config setup required\n\n### Install\n\n**Mac / Linux:**\n\ncurl -fsSL [https://github.com/KrishivPiduri/repo-brain/releases/latest/download/install.sh](https://github.com/KrishivPiduri/repo-brain/releases/latest/download/install.sh) | bash\n\n**Windows (PowerShell):**\n\nirm [https://github.com/KrishivPiduri/repo-brain/releases/latest/download/install.ps1](https://github.com/KrishivPiduri/repo-brain/releases/latest/download/install.ps1) | iex\n\n### Assets\n\nUpload these files to this release:\n\n- install.sh\n- install.ps1\n- repo-brain.zip (zip of: main.py, llm.py, ingest.py, analyze.py,\n\nrelationships.py, generate_prompt.py, mcp_server.py,\n\nconfig.example.py, requirements.txt)", "url": "https://wpnews.pro/news/how-to-optimize-your-ai-token-usage", "canonical_source": "https://github.com/KrishivPiduri/repo-brain/releases/tag/v1.0.0", "published_at": "2026-05-29 02:24:46+00:00", "updated_at": "2026-05-29 02:45:23.904027+00:00", "lang": "en", "topics": ["ai-tools", "large-language-models", "ai-infrastructure"], "entities": ["OpenAI", "Claude", "Deepseek", "Gemini", "Groq", "Ollama", "Mistral", "xAI"], "alternates": {"html": "https://wpnews.pro/news/how-to-optimize-your-ai-token-usage", "markdown": "https://wpnews.pro/news/how-to-optimize-your-ai-token-usage.md", "text": "https://wpnews.pro/news/how-to-optimize-your-ai-token-usage.txt", "jsonld": "https://wpnews.pro/news/how-to-optimize-your-ai-token-usage.jsonld"}}