Skip to content

Repository files navigation

🤖 Chat Py

Python Badge Discord Badge

✨ A colorful and modern way to chat with OpenRouter-powered AI models ✨

Chat Py is a lightweight Python chat client that connects to OpenRouter-compatible models through the OpenAI SDK. It supports both a terminal-based CLI and a Tkinter-based GUI.

🌈 Features

  • 🎯 Choose from several OpenRouter models
  • 💬 Chat through the terminal or a GUI window
  • ⚡ Use slash commands such as:
    • /model to show the current model
    • /exit to quit the app
    • /save to save the conversation history
  • 🛠️ Use a setup helper to install dependencies and create a .env file
  • 🪟 Configure GUI window size and resize behavior with environment variables

📁 Project Files

  • main.py – CLI chat app entry point
  • main_gui.py – Tkinter GUI app entry point
  • logo.py – prints the startup logo
  • save.py – saves chat history to a text file
  • setup.py – installs dependencies and creates the .env file
  • requirements.txt – Python package requirements
  • pyproject.toml – packaging metadata

✅ Requirements

  • 🐍 Python 3.9 or newer
  • 🔑 An OpenRouter API key

⚙️ Setup

  1. Create and activate a virtual environment (recommended):

    python -m venv .venv
    .venv\Scripts\activate
  2. Install the required Python packages:

    python -m pip install -r requirements.txt
  3. Run the setup helper:

    python setup.py
  4. Enter your OpenRouter API key when prompted. The setup script will create a .env file in the project root.

You can also install the project in editable mode with:

python -m pip install -e .

🔐 Environment Variables

Create or update the .env file with values like the following:

OPENROUTER_API_KEY=your_openrouter_api_key_here
USER_NAME=Your Name
GUI_window_width=800
GUI_window_height=600
IS_WIDTH_RESIZABLE=True
IS_HEIGHT_RESIZABLE=True

▶️ Run the App

CLI

python main.py

GUI

python main_gui.py

📝 Notes

  • A valid OpenRouter API key is required to use the chat features.
  • If .env already exists, the setup script will add any missing values.
  • The GUI size and resizability are controlled by the values in .env.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages