https://github.com/wilswer/ait
AI in the Terminal
https://github.com/wilswer/ait
ai anthropic chatbot cohere gemini genai groq llm ollama openai ratatui ratatui-rs terminal terminal-user-interface tui
Last synced: 21 days ago
JSON representation
AI in the Terminal
- Host: GitHub
- URL: https://github.com/wilswer/ait
- Owner: wilswer
- License: apache-2.0
- Created: 2024-07-22T18:26:16.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-28T12:52:48.000Z (about 2 months ago)
- Last Synced: 2026-05-22T22:06:07.835Z (26 days ago)
- Topics: ai, anthropic, chatbot, cohere, gemini, genai, groq, llm, ollama, openai, ratatui, ratatui-rs, terminal, terminal-user-interface, tui
- Language: Rust
- Homepage:
- Size: 299 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# AI in the Terminal
`ait` is a terminal user interface for interacting with several
generative large language models from multiple providers.
It uses the [`genai`](https://github.com/jeremychone/rust-genai) crate to
communicate with the model providers.
The TUI is built using the [`ratatui`](https://ratatui.rs) crate.
## Installation
Installation requires `cargo` to be installed.
```bash
cargo install ait
```
### Manual installation
Clone this repository and `cd` to the `ait` directory and run the application using:
```bash
cargo run
```
Install the application by running:
```bash
cargo install --force --path .
```
The binary name is `ait`.
Binaries are also available for download under [Releases](https://github.com/wilswer/ait/releases).
## Usage
The chat interface is modal and starts in the 'normal' mode.
By pressing the `i` key text can be input into the text area.
More information can be found by pressing the `?` key.
To submit queries to the model providers, you either need to obtain an API key and
set the appropriate environment variable OR you need a running
[Ollama](https://ollama.com/) instance on `http://localhost:11434`.
To start the TUI simply run
```bash
ait
```
If you want to provide a custom system prompt, it can be achieved like this:
```bash
ait --system-prompt "You are a helpful, friendly assistant."
```
If you want to add context to your conversation, use the `--context` argument.
```bash
ait --context my_file.txt
```
`ait` can also read from stdin to add context:
```bash
cat my_file.txt | ait
```
A powerful pattern is to use a text serializer such as
[`yek`](https://github.com/bodo-run/yek) and use this as context input:
```bash
yek my_file.txt | ait
```
Or serialize all file in a directory and add as context:
```bash
yek my_dir | ait
```
## Chat history
Chat history is stored as a `sqlite` database (facilitated by the
[`rusqlite`](https://github.com/rusqlite/rusqlite) crate)
in the platform's standard data directory:
- macOS: `~/Library/Application Support/ait/chats.db`
- Linux: `~/.local/share/ait/chats.db`
- Windows: `%APPDATA%\ait\chats.db`
In addition, `ait` will store a log of the latest chat in the platform's cache directory:
- macOS: `~/Library/Caches/ait/latest-chat.log`
- Linux: `~/.cache/ait/latest-chat.log`
- Windows: `%LOCALAPPDATA%\ait\latest-chat.log`
I'm probably the only one using this tool but for users of `ait` version 0.5.1 and
earlier, to keep your old database, simply copy it from the previous location:
```bash
cp ~/.cache/ait/chats.db
```