Skip to main content
Glama
8b-is
by 8b-is
token_comparison.mdβ€’4.69 kB
# πŸ“Š Token Usage Comparison Chart ## Adding a Single Function ### Traditional Method (Full File Edit) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SEND ENTIRE FILE TO AI β”‚ β”‚ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β”‚ 850 tokens β”‚ (All 41 lines of user_service.rs) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ AI RETURNS ENTIRE MODIFIED FILE β”‚ β”‚ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β”‚ 900 tokens β”‚ (Now 45 lines with new function) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ **Total: 1,750 tokens** 😱 ### Smart Edit Method (Surgical Edit) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ SEND ONLY THE CHANGE β”‚ β”‚ β–“β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β”‚ 35 tokens β”‚ { β”‚ β”‚ "operation": "InsertFunction", β”‚ β”‚ "name": "delete_user", β”‚ β”‚ "after": "get_user", β”‚ β”‚ "body": "..." β”‚ β”‚ } β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ CONFIRMATION β”‚ β”‚ β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ β”‚ 5 tokens β”‚ "Success" β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ **Total: 40 tokens** πŸš€ ## Batch Operations Comparison ### Traditional: Multiple Round Trips ``` Round 1: Add Import β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ 800 tokens (full file) Round 2: Add Function β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ 850 tokens (full file) Round 3: Update Function β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ 900 tokens (full file) Round 4: Add Error Type β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ 950 tokens (full file) Total: 3,500 tokens πŸ“ˆ ``` ### Smart Edit: Single Request ``` Batch Operation { β–“β–“β–“β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 120 tokens edits: [ AddImport, InsertFunction, ReplaceFunction, InsertClass ] } Total: 120 tokens πŸ“‰ ``` ## Savings by Operation Type | Operation | Traditional | Smart Edit | Savings | |-----------|------------|------------|---------| | Add Function | 850-900 tokens | 30-40 tokens | 95% | | Update Function | 800-850 tokens | 40-50 tokens | 94% | | Add Import | 300-400 tokens | 15-20 tokens | 93% | | Extract Function | 900-1000 tokens | 50-60 tokens | 94% | | Batch (5 ops) | 4000+ tokens | 150-200 tokens | 96% | ## Visual Token Bar Chart ``` Traditional Method: β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ 100% Smart Edit Method: β–“β–“β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ 5% 95% Reduction! ``` ## Cost Implications Assuming $0.01 per 1K tokens: | Scenario | Traditional Cost | Smart Edit Cost | Savings | |----------|-----------------|-----------------|---------| | Single Edit | $0.018 | $0.0004 | $0.0176 | | 10 Edits/Day | $0.18 | $0.004 | $0.176 | | 100 Edits/Day | $1.80 | $0.04 | $1.76 | | Monthly (3000) | $54.00 | $1.20 | $52.80 | ## Why This Matters 1. **Speed**: Less data = faster API calls 2. **Cost**: 95% fewer tokens = 95% lower API costs 3. **Accuracy**: No risk of AI changing unrelated code 4. **Scale**: Edit 100 files as cheaply as traditionally editing 5 --- *"Efficiency isn't just about speedβ€”it's about doing more with less."* Smart Tree: Where every token counts! 🎯✨

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/8b-is/smart-tree'

If you have feedback or need assistance with the MCP directory API, please join our Discord server