Hi Streamlit Community!
I wanted to see if I could build a chat client that doesn’t just talk to one AI – but switches between Claude, Mistral, and DeepSeek on the fly, without losing context.
What is 20centAI?
It starts as a simple chat interface. But under the hood, it demonstrates three patterns for building robust AI integrations:
- Provider Abstraction: Swap models mid-conversation (no code changes)
- Rolling Compression: Older messages get summarized automatically (~90% token savings)
- Explicit State: No Streamlit magic – everything is transparent and testable
The Tech Stack:
- Streamlit: UI and session management
- Python Protocols: Clean provider interface
- Heuristic Compression: Simple but effective context management
- ~600 lines total: Built to be read, not just run
What I learned:
- Context management is harder than it looks
- Token costs add up fast – compression isn’t optional for long chats
- Sometimes the simplest heuristic beats a complex algorithm
Check it out:
- GitHub: GitHub - 20centAI/20centai: Educational AI chat client: provider abstraction, token compression & state management in ~600 lines Python. Learn robust AI integration patterns. · GitHub
- (No live demo yet – but it runs locally in <2 minutes)
The question for you:
If you were building a multi-provider chat app, what pattern would you try first?
Or: What’s the one thing you’d change about this approach?
No pressure – just curious what other Streamlit devs think.
P.S. If you find a bug: That’s not a feature. Please tell me.