Skip to main content

A beautiful CLI for testing OpenAI-compatible chat APIs

Project description

oaichat

A beautiful CLI for testing and interacting with OpenAI-compatible chat APIs.

Features

  • 🎨 Beautiful CLI with Rich-powered formatting and markdown rendering
  • 🔌 Multi-provider support - OpenAI, Ollama, Groq, Together AI, LM Studio, and more
  • 💾 Persistent conversations - Resume chats anytime with SQLite storage
  • 🎯 Named profiles - Easily switch between different API providers
  • 🌊 Streaming responses - See tokens as they arrive (or wait for complete responses)
  • 📊 Token usage tracking - Monitor your API usage
  • 🎭 System prompts - Customize model behavior per profile or conversation
  • 📤 Export conversations - Save to JSON or Markdown
  • 🤖 Auto-generated titles - Conversations name themselves

Installation

pip install oaichat

Or install from source:

git clone https://github.com/yourusername/oaichat.git
cd oaichat
pip install -e .

Quick Start

1. Add a profile

# OpenAI
oaichat profile add openai --base-url https://api.openai.com/v1 --api-key sk-... --model gpt-4o

# Ollama (local)
oaichat profile add ollama --base-url http://localhost:11434/v1 --api-key ollama --model llama3

# Groq
oaichat profile add groq --base-url https://api.groq.com/openai/v1 --api-key gsk-... --model llama-3.1-70b-versatile

2. Chat!

# Start an interactive chat session
oaichat chat

# Send a one-off message
oaichat send "Explain quantum computing in simple terms"

# Use a specific profile and model
oaichat chat --profile ollama --model llama3

3. Manage conversations

# List all conversations
oaichat convo list

# Resume a previous conversation
oaichat convo resume <conversation-id>

# Export to markdown
oaichat convo export <conversation-id> --format md

Commands

Profile Management

oaichat profile add <name>           # Add a new API profile
oaichat profile list                 # List all profiles
oaichat profile show <name>          # Show profile details
oaichat profile set-default <name>   # Set default profile
oaichat profile remove <name>        # Remove a profile

Model Management

oaichat model list                   # List available models from current profile
oaichat model list --profile <name>  # List models from specific profile
oaichat model set <model-name>       # Set default model for current profile

Chatting

oaichat chat                         # Start interactive chat
oaichat chat --profile <name>        # Use specific profile
oaichat chat --model <name>          # Use specific model
oaichat chat --system "You are..."   # Set system prompt
oaichat chat --temperature 0.7       # Set temperature
oaichat chat --max-tokens 2000       # Set max tokens
oaichat chat --no-stream             # Wait for complete response

oaichat send "message"               # Send one-off message
oaichat send "message" --save        # Save one-off message to history

Interactive Chat Commands

While in an interactive chat session:

  • /exit - Exit the chat
  • /clear - Clear conversation history (start fresh)
  • /system <prompt> - Change system prompt
  • /model <name> - Switch model
  • /save - Force save and generate title
  • /usage - Show session token usage

Conversation Management

oaichat convo list                   # List all conversations
oaichat convo list --profile <name>  # Filter by profile
oaichat convo list --limit 50        # Show more conversations
oaichat convo show <id>              # Display full conversation
oaichat convo resume <id>            # Resume interactive chat
oaichat convo delete <id>            # Delete conversation
oaichat convo export <id> --format json  # Export to JSON
oaichat convo export <id> --format md    # Export to Markdown

Configuration

Profiles and settings are stored in your platform's app directory:

  • Linux: ~/.config/oaichat/
  • macOS: ~/Library/Application Support/oaichat/
  • Windows: %APPDATA%\oaichat\

Environment Variables

Override profile settings with environment variables:

export OAICHAT_API_KEY=sk-...
export OAICHAT_BASE_URL=https://api.openai.com/v1
export OAICHAT_MODEL=gpt-4o

Supported Providers

oaichat works with any OpenAI-compatible API:

Provider Base URL Notes
OpenAI https://api.openai.com/v1 Requires API key
Ollama http://localhost:11434/v1 Local, free
LM Studio http://localhost:1234/v1 Local, free
Groq https://api.groq.com/openai/v1 Requires API key
Together AI https://api.together.xyz/v1 Requires API key

License

MIT License - see LICENSE for details.

Contributing

Contributions welcome! Please open an issue or PR.

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

oaichat-0.1.0.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

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

oaichat-0.1.0-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

Details for the file oaichat-0.1.0.tar.gz.

File metadata

  • Download URL: oaichat-0.1.0.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oaichat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 55f750dc4822f5bce98e786be8efc8409b5d4538a01f3a35d2dcc33a81001726
MD5 71b81e5a5c3be99fcdf3202d01f46990
BLAKE2b-256 5d93723c6d2c7f6cb452fa235db50fb39d641b884c9fc1661b1da16064ee2039

See more details on using hashes here.

File details

Details for the file oaichat-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oaichat-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for oaichat-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c1d6c0fd32e3a9e613ee26933125647e1beddcd7dbc350e1ab1a026e851a784
MD5 c30419c93db6e183e59fd0bbbabc8a47
BLAKE2b-256 ee639733127070b34c6156aba57b878edc25587f583ab159062e27e6e69c20ba

See more details on using hashes here.

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