https://github.com/nitefood/ai-bash
AI - a simple commandline local/remote LLM chat client. Supports any local or remote OpenAI-compatible API endpoint (GPT4o, Gemini, Grok, OpenRouter, Ollama, LM Studio and more), model management, multiple conversations support, automatic topic identification, image generation using Dall-E and stdin piping (sending files to LLM for inspection)
https://github.com/nitefood/ai-bash
ai bash chatbot chatgpt chatgpt-4 chatgpt-api commandline completions conversational-ai dalle2 gemini gemini-api gemini-pro gpt-4 gpt-4o grok-api image-generation openai-api shell terminal
Last synced: 27 days ago
JSON representation
AI - a simple commandline local/remote LLM chat client. Supports any local or remote OpenAI-compatible API endpoint (GPT4o, Gemini, Grok, OpenRouter, Ollama, LM Studio and more), model management, multiple conversations support, automatic topic identification, image generation using Dall-E and stdin piping (sending files to LLM for inspection)
- Host: GitHub
- URL: https://github.com/nitefood/ai-bash
- Owner: nitefood
- Created: 2023-03-13T00:31:40.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-08-12T01:23:11.000Z (about 2 months ago)
- Last Synced: 2025-08-12T03:25:05.840Z (about 2 months ago)
- Topics: ai, bash, chatbot, chatgpt, chatgpt-4, chatgpt-api, commandline, completions, conversational-ai, dalle2, gemini, gemini-api, gemini-pro, gpt-4, gpt-4o, grok-api, image-generation, openai-api, shell, terminal
- Language: Shell
- Homepage:
- Size: 93.8 KB
- Stars: 68
- Watchers: 5
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-cli-apps - AI - A command-line ChatGPT client in BASH with conversation/completion support. (<a name="ai"></a>AI / ChatGPT)
- awesome-cli-apps-in-a-csv - AI - A command-line ChatGPT client in BASH with conversation/completion support. (<a name="ai"></a>AI / ChatGPT)
README
# AI - a commandline LLM chat client in BASH with conversation/completion and image generation support
## Features:
* **Supports any OpenAI-compatible API endpoint, both local and remote**
* _[OpenAI](https://platform.openai.com/docs/)_
* _[Gemini](https://aistudio.google.com/)_
* _[Grok](https://x.ai/api)_
* _[HuggingFace](https://huggingface.co/docs/api-inference/index)_
* _[OpenRouter](https://openrouter.ai/docs/quick-start)_
* _[LM Studio](https://lmstudio.ai/docs/api/openai-api)_
* _[Ollama](https://ollama.com/blog/openai-compatibility)_
* _and many more_* **Interactive chat sessions**
* **Multiline input**
* **Image generation support:** *(currently limited to DALL·E 2)*
* _image preview grid rendered directly in the terminal_
* _generate up to 10 images at a time_
* _automatic URL shortening_
* _optionally save images and prompt to local disk_* **Markdown support for replies** (requires [glow](https://github.com/charmbracelet/glow#installation))
* **Single turn Q&A** with optional follow-up conversation
* **Data piping support** (sending file contents to the LLM)
* **Full conversation support**:
* _locally store unlimited conversations (in JSON format)_
* _quick resume last conversation_
* _delete/resume any stored conversation_
* _conversation messages replay on resume_
* _store current and start new conversation (reset history) during interactive sessions_
* _Automatic conversation topic identification and update_* **Multiple chat models support**:
* _switch to a different model mid-conversation_
* _can freely combine local and remote models_
* _a single tool to query any model served through an OpenAI-compatible API endpoint_* **Multiple system prompt support**:
* _manage multiple system prompts to alter the base model behavior and persona_
## Full command line options (`ai -h`):
###### Manage models (add/delete/set default):
`ai -m`
###### Manage system prompts (add/delete/set default):
`ai -s`
###### Disable markdown rendering:
`ai -n`
###### Start a new interactive conversation [optionally overriding the default model/system prompt]:
`ai [-m |-s ]`
###### Single turn Q&A (will ask you to continue interacting, otherwise quit after answer):
`ai [-m |-s ] "how many planets are there in the solar system?"`
###### Generate one or more images (default 1, max 10):
`ai -i [num] "a cute cat"`
###### Submit data as part of the question:
`cat file.txt | ai [-m |-s ] "can you summarize the contents of this file?"`
###### List saved conversations:
`ai -l`
###### Continue last conversation:
`ai -c`
###### Continue specific conversation:
`ai -c `
###### Delete a specific conversation:
`ai -d `
###### Delete selected conversations:
`ai -d -`
###### Delete all conversations:
`rm "$HOME/.config/ai-bash/conversations.json"`
## Usage examples:
##### (Adding a model)

##### (Listing added models)

##### (Interaction and conversation resuming)
[](https://asciinema.org/a/572784)
##### (Image generation)
[](https://asciinema.org/a/572785)
##### (Input piping to stdin)
[](https://asciinema.org/a/572786)
## Installation:
###### Prerequisites:
* Install jq, curl, imagemagick, catimg, fzf
* for e.g. Ubuntu: `apt -y install jq curl imagemagick catimg fzf`* Install [glow](https://github.com/charmbracelet/glow#installation) for Markdown rendering support in your terminal
###### Script download:
Install the script by either cloning this repository or directly downloading to your `$PATH`, e.g.:
```shell
curl "https://raw.githubusercontent.com/nitefood/ai-bash/master/ai" > /usr/bin/ai && chmod 0755 /usr/bin/ai
```