Skip to content

Commit 2167b8a

Browse files
authored
Update README.md
This update ensures full alignment with the latest rewritten script
1 parent 39538fb commit 2167b8a

File tree

1 file changed

+56
-36
lines changed

1 file changed

+56
-36
lines changed

README.md

Lines changed: 56 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,24 @@ Simple terminal app to use OpenRouter.ai with your personal API keys. Ask questi
55
Please note that free models on openrouter.ai (those with :free in their slug) are typically limited to 50 requests per day if you have not purchased credits. A request on OpenRouter.ai is defined as a single API call or message sent to the model—essentially, each question or prompt you send, regardless of its length or the number of tokens involved. For 99% of people using this script, is more that enough. These limits apply per account, not per model. Switching between free models does not reset your daily quota. Please read their documentation for more: https://openrouter.ai/settings/credits
66

77
## Features
8-
9-
- 🚀 Simple command-line interface
10-
- 🔑 Secure API key and model management with `.env` file
11-
- 🎯 Clean output (only the AI response, no JSON clutter)
12-
- 💬 Natural language queries
13-
- 🆓 Uses free Mistral model by default
14-
-**Stateless design** - each query is independent (no conversation history between queries)
15-
- 📝 **Conversation History Storage** - All chat sessions are saved as text files in the `chat_sessions` folder for later reference
8+
- 🚀 Minimalist CLI interface — talk to AI directly from your terminal.
9+
- 🔑 Secure API key & model config — stored in .env file, no need to enter every time.
10+
- 🤖 Full session memory — ongoing conversations with proper context (stateful chat).
11+
- 💬 Natural language queries — just type like you're talking to a buddy.
12+
- 💾 Chat history saved — all conversations stored as timestamped .txt files inside chat_sessions/.
13+
- 🧠 Dynamic AI name display — bot replies are labeled with the selected model (e.g. Mistral AI:).
14+
- 👤 Personalized & interactive input — uses your system username in the prompt and supports arrow keys for editing your message like a real terminal app.
15+
- 🧹 Clean output — only the answer, no JSON noise.
16+
- 🆓 Uses a free model by default — no paid account required.
17+
- 🔍 Smart package manager detection — if curl or jq is missing, the script tells you exactly how to install it (e.g. sudo pacman -S jq).
18+
- 🧪 Works on Linux & macOS — tested on Arch-based, Debian-based and macOS (via brew).
19+
- ✨ Zero dependencies beyond curl + jq — no Python, no Node.js, no drama.
20+
- 🐞 Debug mode support — run with DEBUG=true to see full raw API responses on errors in the terminal.
21+
- 🧼 Session history is always clean — error messages are never saved in the logs, whether debug mode is on or off (default).
1622

1723
### Important Note
18-
19-
This tool is designed for **single-question interactions** - each query is independent with no memory of previous conversations (Stateless design). However, it **stores conversation history** for your convenience. Each time you run the script, it saves both your question and the AI's response to text files in the `chat_sessions` folder. The files are named using the first sentence of your question, making it easy to find and review previous conversations. If you ask the exact same question again, the new response will be appended to the existing file.
20-
24+
This CLI tool now supports ongoing, contextual chat with the AI.
25+
Unlike the old one-shot version (ask once, get one reply), this new version maintains the full conversation history during a session — so you can chat back and forth naturally, with context.
2126

2227
## Prerequisites
2328

@@ -88,37 +93,53 @@ sudo apt install jq
8893

8994
## Usage
9095

91-
### Basic Usage
96+
### Basic Usage with Sample Output
9297

9398
```bash
94-
./ai.sh your question here
95-
```
96-
### Examples
99+
./ai.sh
97100

98-
```bash
99-
# Ask a simple question
100-
./ai.sh what is the meaning of life
101+
💬 Start a conversation! Type your message and press Enter (Ctrl+C to exit)
102+
103+
🧑 cerebrux: What's the capital of Greece?
101104
102-
# Ask for coding help
103-
./ai.sh how do I create a function in Python
105+
🤖 Mistral AI:
106+
Athens is both the historical heart and the modern capital of Greece
104107
105-
# Ask for a definition
106-
./ai.sh define recursion
108+
🧑 cerebrux: Did they have a co-capital there?
107109
108-
# Note for zsh users: If your question ends with a ?, make sure to wrap it in quotes
109-
./ai.sh "what is the meaning of life?"
110+
🤖 Mistral AI:
111+
Thessaloniki is widely recognized as Greece's "second city" due to its size and economic
112+
power.
113+
The term "co-capital" (**συμπρωτεύουσα** - symprotévousa) when applied to Thessaloniki
114+
is an honorary, historical, and cultural designation reflecting its immense importance.
110115
```
116+
### Showing Error Messages with DEBUG true/false(deafult)
117+
```bash
118+
➜ openrouter.ai git:(main) ✗ DEBUG=true ./ai.sh
111119

112-
### Sample Output
120+
💬 Start a conversation! Type your message and press Enter (Ctrl+C for exit)
113121

114-
```bash
115-
$ ./ai.sh what is the meaning of 42
116-
🤖 AI response:
122+
🧑 cerebrux: Hi!
117123

118-
The number **42** has gained fame as the "Answer to the Ultimate Question of Life, the Universe,
119-
and Everything" in *The Hitchhiker's Guide to the Galaxy* by **Douglas Adams**.
124+
❌ API Error: No auth credentials found
125+
126+
🔍 Full response for debugging:
127+
{
128+
"error": {
129+
"message": "No auth credentials found",
130+
"code": 401
131+
}
132+
}
120133
```
134+
```bash
135+
➜ openrouter.ai git:(main) ✗ ./ai.sh
136+
137+
💬 Start a conversation! Type your message and press Enter (Ctrl+C for exit)
138+
139+
🧑 cerebrux: Hi!
121140

141+
❌ API Error: No auth credentials found
142+
```
122143
## Creating a Terminal Alias (Recommended)
123144

124145
For easier access, you can create an alias so you can use the script from anywhere without typing the full path:
@@ -207,14 +228,13 @@ Check your `.env` file for the complete list.
207228
- Check your internet connection
208229
- Ensure you haven't exceeded any rate limits
209230

210-
### Debug Mode
231+
### 🐛 Debug Mode
211232

212-
The script automatically shows the full JSON response when it encounters errors or unexpected responses. If you need to see the raw API response for debugging purposes, the script will display it when:
213-
- The API returns an error
214-
- The response format is unexpected
215-
- The content cannot be extracted properly
233+
To enable raw API response output for troubleshooting, run the script with:
216234

217-
This provides all the debugging information you need without manually modifying the script.
235+
```bash
236+
DEBUG=true ./ai.sh
237+
```
218238

219239
## License
220240

0 commit comments

Comments
 (0)