← 返回命令列表

Linux command

aichat 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Ask a question

aichat "[explain quicksort]"

Pipe input for analysis

cat [file.py] | aichat "[review this code]"

Use a specific model

aichat --model [claude:claude-sonnet-4-20250514] "[question]"

Execute shell commands from natural language

aichat -e "[list large files in current directory]"

Start interactive chat session

aichat

Use a role/persona

aichat --role [shell] "[find duplicate files]"

Process a file

aichat --file [document.pdf] "[summarize this]"

说明

aichat is an all-in-one AI CLI tool supporting chat, command execution, and RAG (Retrieval-Augmented Generation). It works with 20+ AI providers including OpenAI, Claude, Gemini, Ollama, Azure, and many more. In chat mode, it provides a REPL with conversation history, multi-line input, and syntax highlighting. Execute mode translates natural language descriptions into shell commands and optionally runs them. RAG mode indexes documents for question-answering over local files. Roles define reusable personas and system prompts. Built-in roles include %code%, %shell%, %explain-shell%, and %functions%. Custom roles are defined as individual files in the roles configuration directory. The tool supports function calling, allowing AI models to invoke defined tools. Sessions persist conversations across invocations. Multiple providers and models can be configured simultaneously. Install via `cargo install aichat`, Homebrew, or download binaries.

参数

-m, --model _MODEL_
Model to use (provider:model format).
-r, --role _ROLE_
Use a predefined role/persona.
-e, --execute
Execute mode: translate natural language to shell commands.
--file _FILE_
Include file in the conversation.
-S, --no-stream
Disable streaming output.
--list-models
List available models.
--list-roles
List available roles.
--info
Show current configuration.

FAQ

What is the aichat command used for?

aichat is an all-in-one AI CLI tool supporting chat, command execution, and RAG (Retrieval-Augmented Generation). It works with 20+ AI providers including OpenAI, Claude, Gemini, Ollama, Azure, and many more. In chat mode, it provides a REPL with conversation history, multi-line input, and syntax highlighting. Execute mode translates natural language descriptions into shell commands and optionally runs them. RAG mode indexes documents for question-answering over local files. Roles define reusable personas and system prompts. Built-in roles include %code%, %shell%, %explain-shell%, and %functions%. Custom roles are defined as individual files in the roles configuration directory. The tool supports function calling, allowing AI models to invoke defined tools. Sessions persist conversations across invocations. Multiple providers and models can be configured simultaneously. Install via `cargo install aichat`, Homebrew, or download binaries.

How do I run a basic aichat example?

Run `aichat "[explain quicksort]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -m, --model _MODEL_ do in aichat?

Model to use (provider:model format).