# Repository Briefing: sigoden/aichat
> Source: https://repoforai.com/repo/sigoden/aichat (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/sigoden/aichat
- **Category**: Agents & Frameworks (智能体与框架)
- **Primary Language**: Rust
- **License**: Apache-2.0
- **Engineering Health**: B (55/100 · Maintenance 6/35 · Adoption 18/25 · Releases 11/20 · License 20/20)
- **Latest Release**: v0.30.0 (2025-07-06) — https://github.com/sigoden/aichat/releases
- **Review Snapshot**: 2026-12-01
- **Deployment / Stack Signals**: CLI, Self-Hosted, API
- **Momentum**: 10,622 ★ total (+2 24h / +25 7d) · 763 forks
- **Topics**: `ai`, `ai-agents`, `chatbot`, `claude`, `cli`, `function-calling`, `gemini`, `llm`, `ollama`, `openai`, `rag`, `rust`
- **When to Use**: Best for: Terminal-first teams that want to switch model providers, feed shell output and files into chats, and reuse retrieval or tool workflows through a CLI and local HTTP endpoint. Skip if: You need a production inference engine, a turnkey multi-tenant gateway, or direct access to provider-native features through a single SDK.

## Overview
```text
### Architecture & Core Mechanics
AIChat is a Rust 2021 application with three entry points: one-shot CMD invocations, an interactive REPL and a built-in HTTP server. The manifest includes `clap` for CLI parsing, `reedline` for terminal editing, `tokio` for async execution and `serde_json`/`serde_yaml` for structured data. `config.example.yaml`, `config.agent.example.yaml` and `models.yaml` are concrete starting points for reviewing configuration and model setup.

The CLI assembles a prompt from user input and optional resources, then sends it to a configured model backend through a common provider interface. Roles bind prompts to model settings, sessions retain conversational context, and macros compose REPL commands. Agents combine instructions, function calls and retrieval documents; function calling and MCP connect the application to external tools. The built-in HTTP server is another way to use configured models, not an inference engine.

### Key Capabilities & Differentiators
AIChat connects to more than 20 providers, including OpenAI, Claude, Gemini, Groq, Ollama, and OpenAI-compatible APIs. The terminal accepts stdin, files, directories, URLs and external command output as context. The REPL adds completion, multiline editing and history search. The Shell Assistant generates commands for the current OS and shell; RAG adds document context to conversations.

Running `aichat --serve` starts the local HTTP surface at `127.0.0.1:8000` by default. It exposes `/v1/chat/completions`, `/v1/embeddings` and `/v1/rerank`. The proxy example uses `"stream": true` for chat completions. The browser playground provides interactive access to configured models, and the arena supports side-by-side comparison. Test the operations you need against the chosen backend rather than assuming that every provider supports all three endpoints.

### Trade-offs & Limitations
Compared with a provider-specific CLI, AIChat reduces the work of switching models and reusing terminal workflows across providers. Compared with direct SDK integration, its local HTTP surface gives clients a common endpoint, but model IDs, streaming behavior and support for embeddings or reranking still need testing for each backend. If an application depends on one provider's native options or error semantics, its SDK may be the simpler path.

Self-hosting the CLI or proxy does not make inference local: selecting a hosted backend can send prompts and supplied context outside the host. Treat fetched URLs and tool output as untrusted, review generated shell commands before running them, and scope external tool credentials to the task. The application is dual-licensed under MIT or Apache-2.0; that choice does not cover provider terms, model licenses or rights to indexed documents.

### Hardware & Deployment Guide
Install with Cargo, Homebrew, Pacman, Scoop or Termux, or put a prebuilt macOS, Linux or Windows binary on `PATH`. The binary does not bundle a model: configure access to a hosted provider or provision a backend such as Ollama separately. For local inference, size RAM and VRAM for the model and inference workload; for hosted APIs, plan around network latency, provider limits and cost. To run offline, keep the model, required retrieval components and tools local and avoid workflows that fetch remote resources.

Start with the default loopback listener for local clients. Before sharing it, verify access controls, provider credential handling and behavior under concurrent load. Upgrades also warrant configuration checks: v0.29.0 replaced `prelude` with `cmd_prelude`, and v0.30.0 dropped the Lingyiwanwu client while adding OSC52 clipboard support and automatic light/dark theme detection.
```

## Key Capabilities
```text
- Provider routing: A common interface covers more than 20 providers, including hosted APIs, Ollama and OpenAI-compatible endpoints.
- Terminal inputs: CMD and REPL can combine prompts with stdin, files, directories, URLs and external command output.
- Workflow reuse: Roles pair prompts with model settings, sessions carry conversation context, and macros replay REPL command sequences.
- Agent composition: Instructions, function calls and RAG documents can be bundled, with MCP available for external tool integration.
- Local HTTP surface: `aichat --serve` exposes three `/v1` endpoints plus a browser playground and side-by-side model arena.
- Release detail: v0.30.0 added OSC52 clipboard support and automatic light/dark theme detection.
```

## Quick Start / Clone
```bash
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
```
