SimpleAIChat logo

SimpleAIChat

Free

Python package for easily interfacing with chat apps, with robust features and minimal code complexity. ![GitHub Repo stars](https://img.shields.io/github/stars/minimaxir/simpleaichat?style=social)

FreeFree tier
Inputs: textOutputs: text
Type
Open Source

About SimpleAIChat

simpleaichat is a Python package designed for easily interfacing with chat apps like ChatGPT and GPT-4, with robust features and minimal code complexity. It provides optimized workflows that minimize token usage to reduce costs and latency, supports running multiple independent chats simultaneously, and features a minimal codebase for easy understanding. The tool includes chat streaming, tool use, async support (including streaming and tools), and the ability to create complex workflows like agents. It comes with hackable examples such as a Python coding assistant, inline tips, async multi-chat, and tabletop RPG campaign generation. Installation is via pip install simpleaichat, and quick demos can be started with just one line of code or from the command line. Future support for PaLM and Claude is planned.

Key Features

Create and run chats with only a few lines of code
Optimized workflows minimize token usage, reducing costs and latency
Run multiple independent chats simultaneously
Minimal codebase for easy understanding
Chat streaming responses and tool support
Async support including streaming and tools
Ability to create complex workflows like agents
Command-line interface for quick chats
Supports custom system prompts and personas

Pros & Cons

Pros
  • Extremely easy to use with minimal code required
  • Cost-efficient due to optimized token usage
  • Supports streaming and async for real-time interactions
  • Allows multiple independent conversations simultaneously
  • Lightweight and transparent codebase
  • Free and open-source software
Cons
  • Currently limited to OpenAI models (ChatGPT/GPT-4) with no built-in support for other providers yet
  • Requires an OpenAI API key, incurring usage costs for the underlying API
  • Documentation and examples are primarily available only on GitHub

Best For

Building custom conversational AI assistantsPrototyping chat-based applications quicklyCreating a Python coding assistant with minimal overheadRunning multiple parallel chat sessions for data collectionDeveloping interactive tabletop RPG generatorsAsync chat workflows for high-throughput applications

FAQ

How do I install simpleaichat?
Install via pip: pip3 install simpleaichat.
How do I start a chat?
Import AIChat and create an instance with an OpenAI API key or set the OPENAI_API_KEY environment variable. For example: AIChat(api_key='sk-...'). Calling it without arguments launches an interactive chat.
What models are supported?
Currently supports ChatGPT and GPT-4. Future support for PaLM and Claude is planned.
Is simpleaichat free?
The package itself is free and open-source. However, you need an OpenAI API key, which incurs usage charges from OpenAI.
Can I run multiple chats at once?
Yes, simpleaichat supports running multiple independent chats simultaneously.