A Rust-based terminal chat client that uses the OpenRouter.ai API to interact with various AI models. Features include chat history management, Markdown-style formatting, and a clean terminal interface.
- Terminal-based Interface: Clean and simple command-line interface
- Chat History: Maintains context across conversations
- Markdown Formatting:
### Headingsdisplayed in bold**bold text**displayed in bold
- Easy Context Management: Clear chat history with simple commands
- Rust and Cargo (latest stable version)
- OpenSSL development libraries
- An OpenRouter.ai API key
- Clone the repository:
git clone https://github.com/yourusername/tchat.git
cd tchat- Build the release version:
cargo build --release- Set up your API key:
mkdir ~/.config/tchat
touch ~/.config/tchat/config
echo "export OPENROUTER_API_KEY=your_api_key_here" > ~/.config/tchat/config- Add config file to .bashrc or .zshrc (for constant import)
echo source ~/.config/tchat/config >> ~/.bashrcecho source ~/.config/tchat/config >> ~/.zshrcRun the program:
./target/release/tchatAvailable commands:
- Type your message and press Enter to chat
- Type
clear contextto reset chat history - Type
exitto quit the program
> Tell me about Rust programming
🤖 Assistant:
### Introduction to Rust
Rust is a **systems programming language** that focuses on three main goals:
- **Safety**: Memory and thread safety guaranteed at compile time
- **Concurrency**: Safe concurrent programming
- **Performance**: Zero-cost abstractions
You can write both low-level and high-level applications in Rust!
For Arch Linux users:
sudo install -Dm755 target/release/tchat /usr/local/bin/tchatDependencies in Cargo.toml:
[dependencies]
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
rustyline = "9.0"
tokio = { version = "1", features = ["full"] }- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenRouter.ai for providing the AI API
- The Rust community for excellent documentation and crates