How to Create a Lichess Bot with BotLi Guide
How to Create a Lichess Bot Using BotLi(GitHub)
In the realm of online chess, automation has become an intriguing frontier. Lichess.org, a leading free and open-source chess platform, offers an API that allows developers to create bots capable of playing games autonomously. This guide provides a comprehensive walkthrough on setting up a Lichess bot using BotLi, a Python-based tool designed for this purpose.(talkchess.com)
Introduction to Lichess Bots
A Lichess bot is an automated account that can play chess games on Lichess.org without human intervention. These bots interact with the Lichess API, enabling them to accept challenges, make moves, and even chat with opponents. They are particularly useful for testing chess engines, hosting online tournaments, or providing practice partners for players.(Reddit)
Creating a Lichess bot involves several steps:(Reddit)
- Creating a dedicated Lichess account: Bots must have their own accounts separate from human users.(GitHub)
- Obtaining an API token: This token authenticates the bot and grants it permission to interact with the Lichess API.
- Setting up the bot software: Tools like BotLi facilitate the connection between your chess engine and Lichess.(Reddit)
- Configuring the chess engine: The engine determines the bot’s playing strength and style.
By following this guide, you’ll be able to set up a functional Lichess bot using BotLi.(Stack Overflow)
Understanding BotLi
BotLi is an open-source Python script that acts as a bridge between Lichess and various chess engines. It allows users to configure bots with different engines, opening books, and settings for various time controls and variants. BotLi’s flexibility makes it a popular choice among developers looking to create customized Lichess bots.(GitHub)
Key Features of BotLi
- Multi-engine support: Configure different engines for various time controls and variants.
- Opening book integration: Utilize opening books to guide the bot’s early-game strategy.
- Syzygy tablebase support: Enhance endgame play with precomputed tablebases.(chess-bot.com)
- Customizable UCI options: Fine-tune engine parameters to adjust playing strength and behavior.
BotLi’s configuration is managed through a YAML file, allowing for straightforward customization.(GitHub)

Setting Up BotLi
Prerequisites
Before proceeding, ensure you have the following:
- Python 3.10 or higher: BotLi requires Python 3.10+.
- Git: To clone the BotLi repository.
- A Lichess account: Dedicated for the bot.
Step 1: Install Python
- Download Python 3.10 or higher from the official website.
- During installation, ensure you check the option to “Add Python to PATH.”(GitHub)
- Verify the installation by running
python --version
in your command prompt or terminal.
Step 2: Clone the BotLi Repository
Open your terminal or command prompt and execute:
git clone https://github.com/Torom/BotLi.git
This command clones the BotLi repository into your local machine.
Step 3: Install Dependencies
Navigate to the BotLi directory:
cd BotLi
Install the required Python packages:
pip install -r requirements.txt
This command installs all necessary dependencies for BotLi to function correctly.
Configuring BotLi
Step 1: Create a Lichess Bot Account
- Visit Lichess.org and create a new account dedicated to your bot.(GitHub)
- After creating the account, log in and navigate to your account settings.
- Under “API Access Tokens,” create a new token with the “Play games with the bot API” permission.(lichess.org)
- Save this token securely; it will be used to authenticate your bot.(Python in Plain English)
Step 2: Configure config.yml
In the BotLi directory, you’ll find a file named config.yml.default
. Make a copy of this file and rename it to config.yml
. Open config.yml
in a text editor and configure the following sections:(lichess.org)
Token
Replace the placeholder with your Lichess API token:
token: "your_api_token_here"
Engine Configuration
Specify the engine details:(talkchess.com)
engines:
standard:
dir: "./engines"
name: "stockfish.exe"
ponder: true
use_syzygy: true
silence_stderr: false
uci_options:
Threads: 8
Hash: 1024
MoveOverhead: 1000
Ensure that the engine executable (e.g., stockfish.exe
) is placed in the specified directory.(GitHub)
Opening Book
Configure the opening book:(GitHub)
opening_books:
books:
default:
path: "./books/book.bin"
standard:
default: default
Place your opening book file in the specified path.
Syzygy Tablebases
If using Syzygy tablebases, specify their path:
syzygy_path: "./syzygy"
Ensure the tablebase files are located in the specified directory.
Running the Bot
With the configuration complete, you can now run your bot. In the BotLi directory, execute:
python lichess-bot.py
Your bot will connect to Lichess and begin accepting challenges based on your configuration.(Reddit)
Bibliography
- Torom/BotLi GitHub Repository: https://github.com/Torom/BotLi(GitHub)
- Outskirts Chess Forum Guide: https://outskirts.altervista.org/forum/viewtopic.php?p=59653&hilit=lichess+Botli#p59653
- Lichess Bot API Documentation: https://lichess.org/api(Python in Plain English)
- Python Official Website: https://www.python.org/
By following this guide, you should have a fully functional Lichess bot powered by BotLi. This setup allows for extensive customization, enabling you to tailor your bot’s behavior to your specific needs. Whether for testing, competition, or entertainment, your Lichess bot is now ready to engage with players around the world.(Stack Overflow)

Jorge Ruiz Centelles
Filólogo y amante de la antropología social africana