STOCKFISH 14–19Latest release: 19Explore engines ↗

Documentation / Guides

A lichess bot backed by the API

play on lichess without hosting an engine

Shape

Use the official lichess-bot framework with a homemade engine class: on each turn, call POST /v1/bestmove with the board FEN and a movetime_ms matching your clock budget, then play the move. options.elo lets the bot play at a rating instead of full strength, which lichess bot etiquette appreciates.

class ApiEngine:
    def __init__(self, key, elo=None):
        self.h = {"Authorization": f"Bearer {key}"}
        self.opts = {"elo": elo} if elo else {}
    def best(self, fen, ms):
        r = requests.post("https://stockfishapi.com/v1/bestmove", headers=self.h,
                          json={"fen": fen, "movetime_ms": ms, "options": self.opts}, timeout=ms/1000 + 5)
        r.raise_for_status()
        return r.json()["bestmove"]

Budget: a 5+3 game is about 60 moves per side at ~2 s each, which is 3 to 4 units a move on the time-based price, so under 250 units a game.

Get a key with one call: POST /v1/signup {"email":"you@example.com"}. Free plan, depth 14, 2,000 units a day.