Show HN: I built COON an code compressor that saves 30-70% on AI API costs
2 points
2 hours ago
| 0 comments
| github.com
| HN
# COON: Compress Your Code, Cut AI Costs by 70%

*Show HN: I built a code compressor that saves 30-70% on AI API costs*

I'm tired of paying $100s/month for AI API calls when half the tokens are just whitespace and boilerplate. So I built COON - a tool that compresses code before sending it to LLMs.

*The problem:* A simple Flutter login screen uses 150 tokens. Multiply that by thousands of API calls and you're burning money.

*The solution:* COON compresses that same code to 45 tokens (70% reduction). Same code, 70% cheaper.

*Example:*

Before (150 tokens): ```dart class LoginScreen extends StatelessWidget { final TextEditingController emailController = TextEditingController(); // ... more boilerplate } ```

After (45 tokens): ``` c:LoginScreen<StatelessWidget>;f:emailController=X;m:b S{a:B{t:T"Login"}... ```

*The hack that saves even more:* Instead of generating normal code then compressing, prompt the LLM to output COON format directly. You save tokens on both the prompt and the response.

Currently supports Dart/Flutter. Python/JS coming soon.

MIT licensed. pip install coon

Feedback welcome - especially on compression strategies and which languages to support next.

GitHub: github.com/AffanShaikhsurab/COON

No one has commented on this post.