#artificial-intelligence #chat-completion #open-ai-compatible #llm #api-key #aichat

app terminal-aichat

A terminal AI/LLM chat tool. Extremely simple and easy to use. Using OpenAI-compatible /v1/chat/completion API

5 releases

Uses new Rust 2024

0.2.5 Sep 16, 2025
0.2.4 Sep 14, 2025
0.2.3 Sep 13, 2025
0.2.2 Sep 13, 2025
0.2.1 Sep 13, 2025

#373 in Cryptography

MIT license

49KB
1K SLoC

terminal-aichat

README中文

A terminal AI/LLM chat CLI

  • very simple and lightweight
  • using /v1/chat/completion API
aichat [MESSAGE]   # chat 
aichat             # chat (enter input mode)

Quick Start

Installation

cargo install terminal-aichat

Prerequisites

Configure a model (example with OpenRouter):

aichat set model my_model_1 --model-name openai/gpt-oss-20b:free --base-url https://openrouter.ai/api/v1 --api-key <YOUR_API_KEY>

aichat use model my_model_1

Chat

# Directly send a message
aichat how to view ubuntu release version

# If your message conflicts with a subcommand, wrap it with quotes
aichat "set swap memory to 0"

# Enter interactive message mode
aichat
how to view ubuntu release version
## (Press Enter for a newline, press Enter twice on an empty line to send)

Usage Examples

View Configurations

aichat list
aichat list model
aichat list prompt

Configure Prompts

aichat set prompt <PROMPT_CONFIG_NAME> --content "your prompt content"
aichat set prompt my_prompt_1 --content "use plain text, give extremely concise output"

Update Model Configuration (Partial Update)

aichat set model my_model_1 --temperature 0.3 --model-name gpt-4o

Set Model Temperature

aichat set model my_model_1 --temperature 0.3

Delete a Configuration Item

aichat delete model sample_model_gpt

Use Temporary API Key via Environment Variable

Useful for avoiding persistent API key storage or for testing. it will override API key in final request.

export OPENAI_API_KEY=sk-***************
aichat "Hello?"

Configuration Files

On first run, the config file is automatically initialized.

  • ~/.terminal-aichat/config.json — stores configuration JSON
  • ~/.terminal-aichat/aes_key.bin — stores the random encryption key for securing API keys (to avoid plaintext storage)
cat ~/.terminal-aichat/config.json

Set Log Level

export LOG_LEVEL=DEBUG

Equivalent to using --verbose

Pure Mode (--pure)

Suppresses all extra messages and outputs only the response.

aichat --pure "Hello?"

Verbose Logging (--verbose)

aichat --verbose "Hello?"

Disable Streaming Mode (--disable-stream)

aichat --disable-stream "Hello?"

Dependencies

~15–32MB
~472K SLoC