Skip to content

Commit 8ab0aa8

Browse files
committed
docs: update README.md
1 parent 361ccfc commit 8ab0aa8

1 file changed

Lines changed: 42 additions & 130 deletions

File tree

README.md

Lines changed: 42 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -16,181 +16,93 @@
1616

1717
---
1818

19-
## Overview
20-
2119
BalatroLLM is a bot that uses Large Language Models (LLMs) to play [Balatro](https://www.playbalatro.com/), the popular roguelike poker deck-building game. The bot analyzes game states, makes strategic decisions, and executes actions through the [BalatroBot](https://github.com/coder/balatrobot) client.
2220

2321
The system combines multiple components to make informed decisions:
2422

25-
- **Strategy templates** (`STRATEGY.md.jinja`) - Define playing style and approach
23+
- **Strategy templates** (`STRATEGY.md.jinja`) - Define the playing style and approach
2624
- **Game state analysis** (`GAMESTATE.md.jinja`) - Current game situation and available options
2725
- **Memory system** (`MEMORY.md.jinja`) - Historical context from previous decisions
2826
- **Action tools** (`TOOLS.json`) - Available game actions and their parameters
2927

30-
These components are processed together in a single LLM call, enabling the bot to understand the current situation and choose the optimal action based on its configured strategy.
31-
32-
## Quick Start
28+
These components are processed together in a single LLM call, enabling the bot to understand the current situation and perform the optimal tool call based on its configured strategy.
3329

34-
### Prerequisites
30+
## 📋 Requirements
3531

3632
- [uv](https://docs.astral.sh/uv/) package manager
3733
- Balatro instance with [BalatroBot](https://github.com/coder/balatrobot) mod installed
3834

39-
### Setup
35+
> [!IMPORTANT]
36+
> Setting up Balatro with the BalatroBot mod requires careful configuration. Please refer to the [BalatroBot](https://github.com/coder/balatrobot) documentation and follow the instructions step by step.
37+
38+
## 📦 Installation
39+
40+
1. Clone the repository
4041

4142
```bash
42-
# 1. Clone the repository
4343
git clone https://github.com/coder/balatrollm.git
4444
cd balatrollm
45+
```
4546

46-
# 2. Create and activate environment
47-
uv sync
48-
49-
# 3. Configure environment
50-
cp .envrc.example .envrc
51-
# edit .envrc with your OpenRouter API key
47+
2. Create environment and install dependencies
5248

53-
# 4. Activate environment
54-
source .envrc
49+
```bash
50+
uv sync --no-dev
5551
```
5652

57-
#### Environment Variables
58-
59-
**OpenRouter API Key** (provides access to all LLM providers)
53+
3. Activate environment
6054

6155
```bash
62-
export OPENROUTER_API_KEY="your-openrouter-api-key"
56+
source .venv/bin/activate
6357
```
6458

65-
Get your API key from: https://openrouter.ai/keys
59+
> [!TIP]
60+
> You can use [direnv](https://direnv.net/) to automatically activate the environment when you enter the project directory. The `.envrc.example` file contains an example configuration for direnv.
6661
67-
The CLI uses sensible defaults for all other configuration:
6862

69-
- Default model: `openai/gpt-oss-20b`
70-
- Default base URL: `https://openrouter.ai/api/v1`
71-
- Default API key: `OPENROUTER_API_KEY` environment variable
72-
- Default strategy: `default`
63+
## ⚙️ LLM Configuration
7364

74-
### Usage
65+
BalatroLLM performs single requests to an OpenAI-compatible chat/completions endpoint. You need to configure:
7566

76-
#### Quick Start
67+
- `--model`: LLM model identifier
68+
- `--base-url`: OpenAI-compatible API base URL
69+
- `--api-key`: API key (if required)
7770

78-
```bash
79-
# 1. Start Balatro with BalatroBot mod (in separate terminal)
80-
./balatro.sh
71+
The default configuration uses [OpenRouter](https://openrouter.ai/), which provides access to many LLMs:
8172

82-
# 2. Run the bot with default settings
83-
balatrollm
84-
85-
# 3. Run with optimizations for different environments
86-
balatrollm --no-screenshot # Headless mode (no screenshots)
87-
balatrollm --use-default-paths # Distributed systems
88-
balatrollm --no-screenshot --use-default-paths # Both optimizations
89-
```
73+
- `--model openai/gpt-oss-20b`: Small, fast, and affordable model
74+
- `--base-url https://openrouter.ai/api/v1`: OpenRouter API base URL
75+
- `--api-key $OPENROUTER_API_KEY`: It's recommended to export the API key in the `.envrc` file.
9076

91-
#### `balatrollm` - Command Line Interface
77+
> [!TIP]
78+
> After configuring the base URL and API key, you can check the available models by running `balatrollm --list-models`
9279
93-
```bash
94-
balatrollm --help
95-
```
80+
## ⚡ Usage
9681

97-
```
98-
usage: balatrollm [-h] [-m MODEL] [-l] [-s STRATEGY] [-u BASE_URL] [-k API_KEY] [-c CONFIG]
99-
[-d RUNS_DIR] [-r RUNS] [-p PORT] [--no-screenshot] [--use-default-paths]
100-
{benchmark} ...
101-
102-
LLM-powered Balatro bot
103-
104-
positional arguments:
105-
{benchmark} Available commands
106-
benchmark Analyze runs and generate leaderboards
107-
108-
options:
109-
-h, --help show this help message and exit
110-
-m, --model MODEL Model name to use from OpenAI-compatible API (default: openai/gpt-oss-20b)
111-
-l, --list-models List available models from OpenAI-compatible API and exit
112-
-s, --strategy STRATEGY
113-
Name of the strategy to use (default: default)
114-
-u, --base-url BASE_URL
115-
OpenAI-compatible API base URL (default: https://openrouter.ai/api/v1)
116-
-k, --api-key API_KEY
117-
API key (default: OPENROUTER_API_KEY env var)
118-
-d, --runs-dir RUNS_DIR
119-
Base directory for storing run data (default: current directory)
120-
-r, --runs RUNS Number of times to run the bot with the same configuration (default: 1)
121-
-p, --port PORT Port for BalatroBot client connection (can specify multiple, default: 12346)
122-
--no-screenshot Disable taking screenshots during gameplay (use for headless mode)
123-
--use-default-paths Use BalatroBot's default storage paths (use for distributed systems)
124-
```
82+
The typical workflow to run BalatroLLM is:
12583

126-
#### `Makefile` - Development Workflow
84+
1. Start Balatro with the BalatroBot mod:
12785

12886
```bash
129-
make help
87+
bash balatro.sh
13088
```
13189

132-
```
133-
BalatroLLM Development Makefile
134-
135-
Available targets:
136-
help Show this help message
137-
install Install package dependencies
138-
install-dev Install package with development dependencies
139-
lint Run ruff linter (check only)
140-
lint-fix Run ruff linter with auto-fixes
141-
format Run ruff formatter
142-
typecheck Run type checker
143-
quality Run all code quality checks
144-
test Run tests
145-
test-cov Run tests with coverage report
146-
all Run all code quality checks and tests
147-
clean Clean build artifacts and caches
148-
setup Kill previous instances and start Balatro
149-
teardown Stop Balatro processes
150-
balatrobench Run benchmark for all models and generate analysis
151-
```
152-
153-
#### `balatro.sh` - Game Automation
90+
2. Run the bot, typically with multiple runs using the same configuration:
15491

15592
```bash
156-
./balatro.sh --help
93+
balatrollm --runs-per-seed 3 --seed ABCDEFG
15794
```
15895

159-
```
160-
Usage: ./balatro.sh [OPTIONS]
161-
./balatro.sh -p PORT [OPTIONS]
162-
./balatro.sh --kill
163-
./balatro.sh --status
164-
165-
Options:
166-
-p, --port PORT Specify port for Balatro instance (can be used multiple times)
167-
Default: 12346 if no port specified
168-
--headless Enable headless mode (sets BALATROBOT_HEADLESS=1)
169-
--fast Enable fast mode (sets BALATROBOT_FAST=1)
170-
--audio Enable audio (disabled by default, sets BALATROBOT_AUDIO=1)
171-
--kill Kill all running Balatro instances and exit
172-
--status Show information about running Balatro instances
173-
-h, --help Show this help message
174-
175-
Examples:
176-
./balatro.sh # Start single instance on default port 12346
177-
./balatro.sh -p 12347 # Start single instance on port 12347
178-
./balatro.sh -p 12346 -p 12347 # Start two instances on ports 12346 and 12347
179-
./balatro.sh --headless --fast # Start with headless and fast mode on default port
180-
./balatro.sh --audio # Start with audio enabled on default port
181-
./balatro.sh --kill # Kill all running Balatro instances
182-
./balatro.sh --status # Show running instances
183-
```
96+
3. Generate benchmark reports from the runs:
18497

185-
## Contributing
98+
```bash
99+
balatrobench --models
100+
```
186101

187-
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on:
102+
> [!TIP]
103+
> You can run `bash balatro.sh --help`, `balatrollm --help`, and `balatrobench --help` to see all available options.
188104
189-
- Setting up the development environment
190-
- Code style and conventions
191-
- Testing guidelines
192-
- Release process
193105

194-
## License
106+
## 📚 Documentation
195107

196-
This project is licensed under the MIT License – see the [LICENSE](LICENSE) file for details.
108+
https://coder.github.io/balatrollm/

0 commit comments

Comments
 (0)