OpenChatKit: Open-Source Framework for Building Custom Chatbots

Jul 7, 2025

Introduction

Building a production-ready conversational AI requires more than just a raw large language model; it requires a system for moderation, retrieval, and fine-tuning. OpenChatKit, with over 9k GitHub stars, provides a comprehensive open-source framework to create both specialized and general-purpose chatbots. It replaces the need for proprietary, closed-source API dependencies by offering a fully transparent stack for developers who need complete control over their AI’s behavior and data.

What Is OpenChatKit?

OpenChatKit is an open-source framework that provides the building blocks for creating instruction-tuned conversational AI systems. It is maintained by Together Computer and released under the Apache 2.0 license, allowing for extensive commercial use and modification.

Unlike a single model release, OpenChatKit is a toolkit containing a base chat model, a dedicated moderation model, and an extensible retrieval system. It was trained on the OIG-43M dataset, a massive collaboration between Together, LAION, and Ontocord.ai, ensuring the base models are highly capable of following complex instructions in natural language.

Why OpenChatKit Matters

For many developers, the primary obstacle to deploying generative AI is the “black box” nature of proprietary models. When using closed APIs, developers have no visibility into the training data, the moderation filters, or the exact weights of the model, which creates risks around data privacy and unpredictable behavior.

OpenChatKit fills this gap by providing a fully open stack. By giving developers access to the source code, model weights, and the training datasets, it empowers them to host their own infrastructure and avoid vendor lock-in. This is particularly critical for industries like healthcare or finance where data residency and strict privacy requirements make third-party API calls impossible.

The project has gained significant traction, as evidenced by its 9k stars on GitHub, because it offers a functional, integrated alternative to the ChatGPT ecosystem that can be run locally or on private clouds.

Key Features

  • Instruction-Tuned Base Models: The kit includes high-performance models like GPT-NeoXT-Chat-Base-20B, which are specifically fine-tuned to follow natural language instructions and maintain coherent dialogue.
  • Dedicated Moderation System: A separate 6-billion parameter model (GPT-JT-Moderation-6B) is used to filter inappropriate content and detect out-of-domain queries, ensuring the bot remains safe and on-topic.
  • Extensible Retrieval-Augmented Generation (RAG): The framework includes a retrieval system that allows the bot to augment its responses with real-time data from Wikipedia, APIs, or custom document repositories.
  • Customization Recipes: OpenChatKit provides documented recipes for fine-tuning the base models on domain-specific data to achieve higher accuracy for specialized tasks.
  • Open Training Data: Access to the OIG-43M dataset allows developers to understand exactly how the model was trained and reproduce or extend the training process.
  • Carbon-Negative Compute: The models were trained using 100% carbon-negative compute, appealing to organizations with strict ESG (Environmental, Social, and Governance) goals.

How OpenChatKit Compares

Feature OpenChatKit Proprietary APIs (e.g., GPT-4) Vicuna / LLaMA-based
Open Source Weights Yes No Yes
Integrated Moderation Yes (Dedicated Model) Yes (Internal) Partial
Custom RAG System Yes (Extensible) Yes (via Plugins) Manual Setup
Training Data Access Yes (OIG-43M) No Partial
Licensing Apache 2.0 Proprietary Varies

OpenChatKit’s primary differentiator is its holistic approach. While many open-source projects release a model (like Vicuna), OpenChatKit releases a system. By bundling the chat model, a safety model, and a retrieval system, it provides a production-ready architecture that reduces the time it takes to move from a raw model to a functional chatbot.

Compared to proprietary APIs, the tradeoff is infrastructure management. Using OpenChatKit requires the developer to manage GPUs and hosting, but in exchange, they gain absolute control over the model’s weights, the moderation logic, and the data flow. For teams that prioritize privacy and sovereignty over convenience, this is the superior choice.

Getting Started: Installation

To use OpenChatKit, you will need a system with NVIDIA GPUs and PyTorch installed. It is recommended to use Miniconda to manage your environment.

Prerequisites

Install Miniconda and Git LFS (Large File Storage) to handle the large model weights.

git lfs install

Environment Setup

Create a Conda environment using the provided configuration file at the root of the repository:

git clone https://github.com/togethercomputer/OpenChatKit.git
cd OpenChatKit
conda env create -f environment.yml

Model Weights Download

Weights for models like GPT-NeoXT-Chat-Base-20B are available on Hugging Face. You can download them directly into the huggingface_models directory of the project.

How to Use OpenChatKit

The simplest way to interact with the models is through the provided command-line shell. This allows you to test the base model’s capabilities without writing any code.

Once your environment is active and weights are downloaded, run the following command from the root of the repo:

python inference/bot.py

By default, the script loads the Pythia-Chat-Base-7B model. You can override this by specifying the model name using the --model flag. The system will then load the model into GPU memory and launch an interactive chat session where you can enter prompts and receive responses in real-time.

Code Examples

OpenChatKit provides scripts for both inference and fine-tuning. Below are examples of how to leverage these tools.

Basic Inference

To run a specific model for a chat session, use the bot.py script:

python inference/bot.py --model GPT-NeoXT-Chat-Base-20B

Fine-Tuning a Model

To adapt the base model to your own data, you can use the provided shell scripts for fine-tuning. For example, to fine-tune the Pythia model:

bash training/finetune_Pythia-Chat-Base-7B.sh

Retrieval-Augmented Generation (RAG)

The retrieval system can be invoked via an API endpoint. To test the retrieval functionality independently, you can use a simple Python request:

import requests
endpoint = 'http://127.0.0.1:7003/search'
res = requests.get(endpoint, params={'q': 'Where is Zurich?'})
print(res.text)

Real-World Use Cases

OpenChatKit is best suited for scenarios where data privacy, model control, and domain specificity are paramount.

  • Private Enterprise Knowledge Bases: A company can fine-tune OpenChatKit on its internal documentation and use the retrieval system to create a secure, internal-only AI assistant that doesn’t leak corporate secrets to third-party APIs.
  • Safe AI for Education: Educational institutions can use the dedicated moderation model to ensure that the AI tutor remains within the scope of the curriculum and filters out inappropriate content for students.
  • NADH
  • Domain-Specific Customer Support: By using the customization recipes, a developer can fine-tune the model on a specific product’s support tickets and manuals, creating a bot that is more accurate than a general-purpose LLM.
  • Academic Research on LLMs: Because the training data (OIG-43M) and weights are open, researchers can study the emergent properties of the model and the effect of different fine-tuning techniques without the restrictions of a closed API.

Contributing to OpenChatKit

OpenChatKit is designed as a community-driven project. While it does not have a formal CONTRIBUTING.md file, contributions are handled through the standard GitHub flow. Developers can report bugs by opening an issue and suggest improvements by submitting a pull request.

The project encourages the contribution of new datasets to the growing corpus of open training data, which helps improve the overall performance of the LLMs over time. By contributing data or code, developers can help build a truly open alternative to the closed-source AI ecosystem.

Community and Support

The primary hub for community interaction is the GitHub repository. Discussions and issues are the main channels for support. Since the project is maintained by Together Computer, the core development is driven by their team, but community feedback is integrated through the same channels.

For those looking to try the model without local installation, a demo is available on Hugging Face Spaces, allowing users to experience the base model’s capabilities in a browser.

Conclusion

OpenChatKit is the right choice for developers who refuse to compromise on data sovereignty and model transparency. It provides a complete system—not just a model—that allows for the lauch of a custom conversational AI with integrated safety and retrieval capabilities.

While the infrastructure requirements (GPUs) are are higher than using a simple API, the long-term benefits of owning your model and your data are immense. If you are building an application where privacy is a non-negotiable requirement, OpenChatKit is the most robust open-source foundation available.

Star the repo, try the quickstart, and join the community to help build the future of open AI.

What is OpenChatKit and what problem does it solve?

OpenChatKit is an open-source framework for building custom chatbots. It solves the problem of proprietary AI lock-in by providing open weights, open training data, and a complete system for moderation and retrieval, allowing developers to host their own conversational AI.

How do I install OpenChatKit?

Installation is performed by cloning the repository and creating a Conda environment using the provided environment.yml file. You will need NVIDIA GPUs and Git LFS installed to handle the model weights.

Can I use OpenChatKit for commercial purposes?

Yes, OpenChatKit is released under the Apache 2.0 license, which is one of the most permissive licenses for commercial use, allowing you to modify and distribute the software for your business.

How does OpenChatKit compare to LLaMA or Vicuna?

While LLaMA and Vicuna are primarily model releases, OpenChatKit is a full framework. It includes a dedicated moderation model and an extensible retrieval system (RAG) out of the box, which are essential for production-grade chatbots.

Can I use OpenChatKit for a private internal knowledge base?

Yes, this is one of the primary use cases. By using the retrieval system and fine-tuning the model on internal documents, you can create a secure AI assistant that operates entirely on your private infrastructure.

What hardware is required to run OpenChatKit?

Running the 20B parameter models requires significant GPU memory. Depending on the quantization (fp16, 8-bit, or 4-bit), you can expect to need between 10GB and 40GB of VRAM, making it suitable for high-end consumer GPUs or enterprise GPUs.

Does OpenChatKit include training data?

Yes, the project provides access to the OIG-43M dataset, which was a collaboration between Together, LAION, and Ontocord.ai, allowing developers to understand the model’s training process and reproduce results.