Skip to content

Latest commit

 

History

26 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IntelliChat

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.

Features

  • 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 .env support for private API keys

Tech Stack

  • Python
  • Streamlit
  • OpenAI Python SDK
  • OpenRouter
  • python-dotenv

Project Structure

.
|-- app.py
|-- Chatbot.py
|-- requirements.txt
|-- README.md
|-- .env.example
|-- .gitignore
`-- .streamlit/
    `-- secrets.toml.example

How It Works

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.

Local Setup

Clone the repository:

git clone https://github.com/UditSingh12/ChatBot-Using-python-streamlit-and-OpenAI.git
cd ChatBot-Using-python-streamlit-and-OpenAI

Install dependencies:

pip install -r requirements.txt

Create a .env file in the project root:

OPENROUTER_API_KEY=your-openrouter-api-key-here
OPENROUTER_MODEL=openrouter/free
OPENROUTER_SITE_NAME=IntelliChat

Run the app:

streamlit run app.py

If streamlit is not recognized, use:

python -m streamlit run app.py

OpenRouter API Key

Create an API key from:

https://openrouter.ai/keys

Paste the key into your local .env file:

OPENROUTER_API_KEY=your-openrouter-api-key-here

Do not commit your real API key to GitHub.

Security Notes

  • Keep .env private.
  • Do not share your OpenRouter API key.
  • Use .env.example only as a template.
  • The real .env file is ignored by Git through .gitignore.

Author

Built by Udit Singh.

About

A sleek and simple but very Optimized chatbot using OpenAI and model is GPT-5.4 with a simple UI Design using Python Streamlit

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages