LLM Token Optimization for OpenCode
My token budget is starting to burn fast. Here are the token optimizations I've done to reduce the cost for OpenCode.
- Install RTK.
- Reduce shell output. See here for the supported commands.
- Install Codegraph.
- Remember to
codegraph initnew repository ! - Make sure that the MCP server is live.
- Remember to
- Install OpenSlimedit.
- The code source is very tiny. It basically compress built-in tool descriptions that are frequently used, and perform additional little optimisations here and there.
- Use cheaper models for subagents.
Excluded plugins
-
Dynamic Context Pruning Plugin : Not particularily convinced that it would reduce cost. Especially when I read their section Impact on Prompt Caching that kinda confirm my skepticism :
Trade-off: Pruning reduces context size but can increase cache misses. The cost balance depends on your conversation, compression frequency, and provider pricing.
Cache misses were exactly a significant part of my tokens cost. No point to risk it only to figure out what "intelligently" managed conversation ever mean.
-
OpenCode Snip : Used to reduce the output of shell commands. Most certainly redunding with RTK.
Publié il y a 2 sem. · Mis à jour la semaine dernière- Install RTK.