# AIChatNG: All-in-one LLM CLI Tool (with response editing) AIChat is an all-in-one LLM CLI tool featuring Shell Assistant, CMD & REPL Mode, RAG, AI Tools & Agents, and More. This is a fork ([why?](#why-fork)) of [aichat](https://github.com/sigoden/aichat) with the following improvements: - Audio/Video input for OpenAI compatible APIs - Browse and search chat history and sessions with the [message viewer](#messages-viewer) - Edit last the response from LLMs using `edit last` command. Similar to oobabooga and open-webui. - Auto complete file system paths after commands that accept paths like `.file ..` - Ollama: reimplemented dedicated Ollama model type with full support for Ollama API instead of the non-complete OpenAI compatibility version. - Disable the terminal spinner animation which is CPU intensive. see `repl_spinner` option in `config.example.yaml`. ## Install ### Package Managers - **Rust Developers:** `cargo install aichat-ng` - **Arch Linux**: Available on [AUR repository](https://aur.archlinux.org/packages/aichat-ng) ### Pre-built Binaries Download pre-built binaries for macOS, Linux, and Windows from [GitHub Releases](https://github.com/blob42/aichat-ng/releases), extract them, and add the `aichat` binary to your `$PATH`. ### From Source - **Rust Developers:** clone this repo and run `cargo install --path .` ### Configuration - The default config directory is ~/.config/aichat_ng or the equivalent base config dir for your platform. - You can keep using the original aichat config by creating a symlink `ln -s ~/.config/aichat ~/.config/aichat_ng` ## Features ### Multi-Providers Integrate seamlessly with over 20 leading LLM providers through a unified interface. Supported providers include OpenAI, Claude, Gemini (Google AI Studio), Ollama, Groq, Azure-OpenAI, VertexAI, Bedrock, Github Models, Mistral, Deepseek, AI21, XAI Grok, Cohere, Perplexity, Cloudflare, OpenRouter, Ernie, Qianwen, Moonshot, ZhipuAI, Lingyiwanwu, MiniMax, Deepinfra, VoyageAI, any OpenAI-Compatible API provider. ### CMD Mode Explore powerful command-line functionalities with AIChat's CMD mode. ![aichat-cmd](https://github.com/user-attachments/assets/6c58c549-1564-43cf-b772-e1c9fe91d19c) ### REPL Mode Experience an interactive Chat-REPL with features like tab autocompletion, multi-line input support, history search, configurable keybindings, and custom REPL prompts. ![aichat-repl](https://github.com/user-attachments/assets/218fab08-cdae-4c3b-bcf8-39b6651f1362) ### Shell Assistant Elevate your command-line efficiency. Describe your tasks in natural language, and let AIChat transform them into precise shell commands. AIChat intelligently adjusts to your OS and shell environment. ![aichat-execute](https://github.com/user-attachments/assets/0c77e901-0da2-4151-aefc-a2af96bbb004) ### Multi-Form Input Accept diverse input forms such as stdin, local files and directories, and remote URLs, allowing flexibility in data handling. Supports images, audio, and video files. | Input | CMD | REPL | | ----------------- | ------------------------------------ | -------------------------------- | | CMD | `aichat hello` | | | STDIN | `cat data.txt \| aichat` | | | Last Reply | | `.file %%` | | Local files | `aichat -f image.png -f data.txt` | `.file image.png data.txt` | | Local directories | `aichat -f dir/` | `.file dir/` | | Remote URLs | `aichat -f https://example.com` | `.file https://example.com` | | External commands | ```aichat -f '`git diff`'``` | ```.file `git diff` ``` | | Combine Inputs | `aichat -f dir/ -f data.txt explain` | `.file dir/ data.txt -- explain` | | Audio files | `aichat -f recording.mp3 -- summarize` | `.file recording.mp3 -- summarize` | | Video files | `aichat -f video.mp4 -- describe` | `.file video.mp4 -- describe` | Supported audio formats: mp3, wav, ogg, flac, m4a, webm, mp4. Video formats: mp4, webm, avi, mov, mkv. Use `.transcript ` to transcribe audio files to text via the transcription API. NOTE: audio/video is only supported for OpenAI compatible APIs. PRs welcome for other providers. - The autocomplete menu will appear for local file system paths as you type ### Role Customize roles to tailor LLM behavior, enhancing interaction efficiency and boosting productivity. ![aichat-role](https://github.com/user-attachments/assets/023df6d2-409c-40bd-ac93-4174fd72f030) > The role consists of a prompt and model configuration. ### Session Maintain context-aware conversations through sessions, ensuring continuity in interactions. ![aichat-session](https://github.com/user-attachments/assets/56583566-0f43-435f-95b3-730ae55df031) > The left side uses a session, while the right side does not use a session. ### Macro Streamline repetitive tasks by combining a series of REPL commands into a custom macro. ![aichat-macro](https://github.com/user-attachments/assets/23c2a08f-5bd7-4bf3-817c-c484aa74a651) ### RAG Integrate external documents into your LLM conversations for more accurate and contextually relevant responses. ![aichat-rag](https://github.com/user-attachments/assets/359f0cb8-ee37-432f-a89f-96a2ebab01f6) ### Function Calling Function calling supercharges LLMs by connecting them to external tools and data sources. This unlocks a world of possibilities, enabling LLMs to go beyond their core capabilities and tackle a wider range of tasks. We have created a new repository [https://github.com/sigoden/llm-functions](https://github.com/sigoden/llm-functions) to help you make the most of this feature. #### AI Tools Integrate external tools to automate tasks, retrieve information, and perform actions directly within your workflow. ![aichat-tool](https://github.com/user-attachments/assets/7459a111-7258-4ef0-a2dd-624d0f1b4f92) #### AI Agents (CLI version of OpenAI GPTs) AI Agent = Instructions (Prompt) + Tools (Function Callings) + Documents (RAG). ![aichat-agent](https://github.com/user-attachments/assets/0b7e687d-e642-4e8a-b1c1-d2d9b2da2b6b) ### Local Server Capabilities AIChat includes a lightweight built-in HTTP server for easy deployment. ``` $ aichat --serve Chat Completions API: http://127.0.0.1:8000/v1/chat/completions Embeddings API: http://127.0.0.1:8000/v1/embeddings Rerank API: http://127.0.0.1:8000/v1/rerank LLM Playground: http://127.0.0.1:8000/playground LLM Arena: http://127.0.0.1:8000/arena?num=2 Messages Viewer: http://127.0.0.1:8000/messages ``` #### Proxy LLM APIs The LLM Arena is a web-based platform where you can compare different LLMs side-by-side. Test with curl: ```sh curl -X POST -H "Content-Type: application/json" -d '{ "model":"claude:claude-3-5-sonnet-20240620", "messages":[{"role":"user","content":"hello"}], "stream":true }' http://127.0.0.1:8000/v1/chat/completions ``` #### LLM Playground A web application to interact with supported LLMs directly from your browser. ![aichat-llm-playground](https://github.com/user-attachments/assets/aab1e124-1274-4452-b703-ef15cda55439) #### LLM Arena A web platform to compare different LLMs side-by-side. ![aichat-llm-arena](https://github.com/user-attachments/assets/edabba53-a1ef-4817-9153-38542ffbfec6) ### Messages Viewer Browse and search your chat history directly in the browser. The Messages Viewer auto-loads your `messages.md` log and all saved sessions — no file upload required. Access it at `http://127.0.0.1:8000/messages` when the server is running (`aichat --serve`). **Features:** - **Auto-loaded history** — your default `messages.md` and all sessions appear on page open - **Session browser** — switch between sessions with a dropdown selector - **Thread sidebar** — clickable list of conversations with titles, timestamps, roles, and RAG labels - **Search & filter** — filter threads by keyword in real time - **Keyboard navigation** — arrow keys to browse threads, `/` to focus search - **Tool call viewer** — inspect tool calls and their results inline - **Dark mode** — matches the terminal aesthetic - **Resizable sidebar** — drag the divider to adjust layout - **File upload fallback** — view external `messages.md` or session YAML files not in your config directory ![aichat-messages](https://github.com/user-attachments/assets/ac5cd489-36f7-4c55-9efe-4605baec1c07) ## Custom Themes AIChat supports custom dark and light themes, which highlight response text and code blocks. ![aichat-themes](https://github.com/sigoden/aichat/assets/4012553/29fa8b79-031e-405d-9caa-70d24fa0acf8) ## Documentation - [Chat-REPL Guide](https://github.com/sigoden/aichat/wiki/Chat-REPL-Guide) - [Command-Line Guide](https://github.com/sigoden/aichat/wiki/Command-Line-Guide) - [Role Guide](https://github.com/sigoden/aichat/wiki/Role-Guide) - [Macro Guide](https://github.com/sigoden/aichat/wiki/Macro-Guide) - [RAG Guide](https://github.com/sigoden/aichat/wiki/RAG-Guide) - [Environment Variables](https://github.com/sigoden/aichat/wiki/Environment-Variables) - [Configuration Guide](https://github.com/sigoden/aichat/wiki/Configuration-Guide) - [Custom Theme](https://github.com/sigoden/aichat/wiki/Custom-Theme) - [Custom REPL Prompt](https://github.com/sigoden/aichat/wiki/Custom-REPL-Prompt) - [FAQ](https://github.com/sigoden/aichat/wiki/FAQ) ## Why Fork Every time I suggested a modification or submitted a PR to the original author, it was declined or turned down with minimal justification. In my opinion, open source thrives on collaboration, so this fork not only incorporates those enhancements but welcomes any reasonable proposals that don't compromise the codebase. Full credit remains due to the original author's contributions, yet the derived work within this repository is exclusively licensed under AGPLv3. ## License This derivative work is licensed under AGPLv3. Copyright blob42. Credit to [aichat](https://github.com/sigoden/aichat) developers. See the LICENSE file for more details.