IntelliChat is an AI chatbot built with Python and Streamlit. It uses the OpenAI Python SDK with OpenRouter as the API provider, so the app can run with OpenRouter's free model router.
The project gives users a clean chat interface, keeps the conversation history inside the Streamlit session, and streams AI responses as they are generated.
- Interactive chatbot UI built with Streamlit
- OpenRouter API support through the OpenAI SDK
- Free-model-first setup using
openrouter/free - Streaming AI responses
- Chat history during the current browser session
- Sidebar model selector for free OpenRouter models
- Clear chat button
- Premium dark UI design
- Local
.envsupport for private API keys
- Python
- Streamlit
- OpenAI Python SDK
- OpenRouter
- python-dotenv
.
|-- app.py
|-- Chatbot.py
|-- requirements.txt
|-- README.md
|-- .env.example
|-- .gitignore
`-- .streamlit/
`-- secrets.toml.example
The app loads an OpenRouter API key from environment variables, creates an OpenAI-compatible client, and sends chat messages to OpenRouter using the selected free model.
app.py and Chatbot.py contain the same Streamlit app so the project works
with either file name.
By default, the app uses:
openrouter/free
This model route is designed to use free models currently available on OpenRouter.
Clone the repository:
git clone https://github.com/UditSingh12/ChatBot-Using-python-streamlit-and-OpenAI.git
cd ChatBot-Using-python-streamlit-and-OpenAIInstall dependencies:
pip install -r requirements.txtCreate a .env file in the project root:
OPENROUTER_API_KEY=your-openrouter-api-key-here
OPENROUTER_MODEL=openrouter/free
OPENROUTER_SITE_NAME=IntelliChatRun the app:
streamlit run app.pyIf streamlit is not recognized, use:
python -m streamlit run app.pyCreate an API key from:
https://openrouter.ai/keys
Paste the key into your local .env file:
OPENROUTER_API_KEY=your-openrouter-api-key-hereDo not commit your real API key to GitHub.
- Keep
.envprivate. - Do not share your OpenRouter API key.
- Use
.env.exampleonly as a template. - The real
.envfile is ignored by Git through.gitignore.
Built by Udit Singh.