Getting Started
Table of contents
Prerequisites
Before installing Batch-GPT, ensure you have:
- Go 1.23.0 or later
- Docker and Docker Compose
- An OpenAI API key
- MongoDB (included in docker-compose setup)
Installation Options
Option 1: Pre-compiled Binaries (Recommended)
-
Download the latest release for your system from the Releases page
- Extract the archive:
tar xzf batch-gpt_[version]_[os]_[arch].tar.gz
- Set up MongoDB:
cd local/mongo docker-compose up -d
Option 2: Building from Source
- Clone the repository:
git clone https://github.com/tanmay17061/batch-gpt.git cd batch-gpt
- Set up MongoDB:
cd local/mongo docker-compose up -d cd ../..
- Build the server:
go build -o batch-gpt server/main.go
Configuration
Set required environment variables:
export OPENAI_API_KEY=your_openai_api_key
export COLLATE_BATCHES_FOR_DURATION_IN_MS=5000
export MONGO_HOST=localhost
export MONGO_PORT=27017
export MONGO_USER=admin
export MONGO_PASSWORD=password
export MONGO_DATABASE=batchgpt
Running the Server
Start the server:
./batch-gpt
The server will start on http://localhost:8080
.
Verification
Test the installation using the provided Python client:
cd test-python-client
pip install -r requirements.txt
python client.py --api chat_completions --content "Hello, World!"
Next Steps
- Learn about different serving modes
- Set up the batch monitor
- Configure caching