Skip to main content

Multi-model AI Chat at the CLI featuring round-table discussions

Project description

AI CLI - Multi-Model AI Command Line Interface

PyPI version Python 3.9+ License: MIT Tests

A powerful command-line interface for interacting with multiple AI models, featuring round-table discussions where different AI models can collaborate and critique each other's responses.

✨ Features

  • 🤖 Multi-Model Support: OpenAI GPT-4, Anthropic Claude, Google Gemini, Ollama (local models)
  • 💬 Three Interaction Modes:
    • Single Chat: Quick one-off conversations
    • Interactive Session: Multi-turn conversations with history
    • Round-Table Discussions: Multiple AI models discussing topics together
  • ⚡ Real-time Streaming: See responses as they're generated
  • 🎨 Rich Terminal UI: Beautiful formatting with markdown support
  • ⚙️ Flexible Configuration: Per-model settings, API key management
  • 🔧 Developer Friendly: Type-safe, well-tested, extensible architecture

🚀 Quick Start

Installation

pip install ai-cli-chat

Basic Setup

  1. Configure API Keys (choose your preferred method):

    # Option 1: Create .env file (recommended)
    ai config env --init
    # Edit the created .env file with your API keys
    
    # Option 2: Set environment variables
    export OPENAI_API_KEY="your-openai-key"
    export ANTHROPIC_API_KEY="your-anthropic-key"
    
  2. Verify Setup:

    ai config list
    

Usage Examples

Single Chat

# Quick question
ai chat "What is machine learning?"

# Use specific model
ai chat --model anthropic/claude-3-sonnet "Explain quantum computing"

Interactive Session

# Start interactive mode
ai interactive

# Within interactive mode:
# /help           - Show available commands
# /model gpt-4    - Switch to different model
# /roundtable     - Start round-table discussion
# /exit           - Exit session

Round-Table Discussions

# Multiple AI models discuss a topic
ai chat --roundtable "What are the pros and cons of remote work?"

# Parallel responses (all models respond simultaneously)
ai chat --roundtable --parallel "Compare Python vs JavaScript"

🛠️ Configuration

Model Management

# List available models
ai config list

# Add a new model
ai config add-model my-gpt4 \
  --provider openai \
  --model gpt-4 \
  --api-key env:OPENAI_API_KEY

# Set default model
ai config set default_model my-gpt4

Round-Table Setup

# Add models to round-table discussions
ai config roundtable --add openai/gpt-4
ai config roundtable --add anthropic/claude-3-sonnet

# List round-table participants
ai config roundtable --list

Environment Variables

# Check environment status
ai config env --show

# Create example .env file
ai config env --init

📋 Supported Models

Provider Model Notes
OpenAI gpt-4, gpt-3.5-turbo Requires OPENAI_API_KEY
Anthropic claude-3-sonnet, claude-3-haiku Requires ANTHROPIC_API_KEY
Google gemini-pro Requires GOOGLE_API_KEY
Ollama llama2, codellama, etc. Local models, no API key needed

🔧 Advanced Configuration

The CLI stores configuration in ~/.ai-cli/config.toml. You can customize:

  • Model Settings: Temperature, max tokens, context window
  • Round-Table Behavior: Discussion rounds, critique mode, parallel responses
  • UI Preferences: Theme, streaming, formatting options

Example configuration:

default_model = "openai/gpt-4"

[models.openai/gpt-4]
provider = "openai"
model = "gpt-4"
api_key = "env:OPENAI_API_KEY"
temperature = 0.7
max_tokens = 4000

[roundtable]
enabled_models = ["openai/gpt-4", "anthropic/claude-3-sonnet"]
discussion_rounds = 2
parallel_responses = false

[ui]
theme = "dark"
streaming = true
format = "markdown"

🤝 Round-Table Discussions Explained

Round-table mode is unique to AI CLI. Here's how it works:

  1. Sequential Mode (default): Models respond one after another, building on previous responses
  2. Parallel Mode (--parallel): All models respond to the original prompt simultaneously
  3. Critique Mode: Later models can reference and critique earlier responses
  4. Multiple Rounds: Configurable discussion rounds for deeper exploration

This creates fascinating conversations where models with different strengths can collaborate, disagree, and build upon each other's ideas.

🧪 Development

Setup

# Clone repository
git clone https://github.com/ai-cli/ai-cli.git
cd ai-cli

# Install with uv (recommended)
uv sync --extra dev

# Or with pip
pip install -e ".[dev]"

Testing

# Run tests
uv run pytest

# With coverage
uv run pytest --cov=ai_cli

# Run linting
uv run ruff check src/ai_cli/
uv run ruff format src/ai_cli/
uv run mypy src/ai_cli/

Pre-commit Hooks

uv run pre-commit install

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

🙏 Acknowledgments

  • Built with Typer for the CLI framework
  • Rich for beautiful terminal output
  • LiteLLM for universal model access
  • Inspired by the need for collaborative AI conversations

📚 Documentation

For detailed documentation, architecture details, and extension guides, see CLAUDE.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_cli_chat-1.0.0.tar.gz (208.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_cli_chat-1.0.0-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file ai_cli_chat-1.0.0.tar.gz.

File metadata

  • Download URL: ai_cli_chat-1.0.0.tar.gz
  • Upload date:
  • Size: 208.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai_cli_chat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 092873f4b63a0f761444e63f6a3ae9b2a1a28cc08ac8b955258db9323bb8b9cb
MD5 4ca6e8adf2f780570a4a25f6d4f54091
BLAKE2b-256 45152ea4c0e7d7eca039bb94ff57b65d06a06899fa5698603074f0954d4bb4f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_cli_chat-1.0.0.tar.gz:

Publisher: release.yml on YusiZhang/ai-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_cli_chat-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ai_cli_chat-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ai_cli_chat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 600a6296b0117dc009811ef6341d602fd799e6daf4392755cddeed688bd795e4
MD5 bc672eb716e633d1145475210ad82588
BLAKE2b-256 7aa798e01f82275ce13ff06f11368cf510039d91143f753f7b33ea99f74f586e

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_cli_chat-1.0.0-py3-none-any.whl:

Publisher: release.yml on YusiZhang/ai-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page