How sanobarsyed/token-counter works
This Streamlit app takes a system prompt, conversation history, and new message, then runs token counting and system-prompt compression when the user clicks “Count + Compress.” It reports per-input and total token usage, context-window percentage, and the compressed prompt’s token savings. The single sampled source file owns the UI, tokenization, Groq request, and comparison; the graph separates these responsibilities without implying they are separate modules. The README documents the model used, which the source confirms in the API request. No distinct persistent store is evident.
Main entry points: app.py Streamlit UI
Components 6
App workflow
- Streamlit UI
app.py - Token counting
app.py - Prompt compression
app.py - Token comparison
app.py
LLM integration
- Groq API
Other components
- User
Connections 10
- User → Streamlit UI: enters prompts
- User → Streamlit UI: clicks to run
- Streamlit UI → Token counting: counts inputs
- Streamlit UI → Prompt compression: requests compression
- Prompt compression → Groq API: sends prompt
- Groq API → Prompt compression: returns completion
- Streamlit UI → Token comparison: provides counts
- Prompt compression → Token comparison: provides compressed text
- Token counting → Token comparison: provides token counts
- Token comparison → Streamlit UI: displays savings