Skip to main content

clichess

tests PyPI license: MIT

Play chess in the terminal against an LLM or against Stockfish.

clichess welcome screen

Install

uv tool install clichess-cli     # or: pipx install clichess-cli / pip install clichess-cli

Then run clichess. The first start offers to download Stockfish (~80 MB); accept it and the eval, the move filter and opponent 0 all work. Any other time: clichess --install-engine.

No Python at all? install.sh (Linux/macOS) or install.ps1 (Windows) in the repository installs uv, a private Python, clichess and Stockfish without administrator rights.

Play

clichess opens the welcome page: a banner, a short intro, and type help. start lists the opponents; a number starts one, q quits. The prompt also takes new, delete NAME|N, opponent NAME|N, continue and author. Numbers renumber themselves: remove opponent 2 and the old 3 becomes 2.

Opponent 0 is Stockfish: it asks how strong it should be, 1) beginner at about 1320 Elo through 6) maximum, which lifts the limit entirely. The eval keeps running at full strength, so the score stays honest even when the opponent is playing badly on purpose.

Opponents

clichess --new              # provider, key, model: three choices, nothing to type
clichess --list
clichess --delete NAME      # or a number from `start`; 0 is Stockfish, never deletable
clichess --opponent NAME    # skip the welcome page; --opponent 0 is Stockfish
clichess --continue         # resume the last game, same opponent and plan

--new offers ChatGPT, Claude, DeepSeek, Gemini, Alibaba and Custom (any OpenAI compatible endpoint: Ollama, LM Studio, vLLM, a gateway). It fills the endpoint itself, then asks the provider which models the key can use and lets you pick one. The last question is a nickname — the name you will pick it by, default being the provider; a name already in use is refused. Custom endpoints may leave the key empty, and if the server cannot list models you type it once.

One JSON file per opponent in ~/.config/clichess/opponents/, mode 600 because it holds the key:

{ "name": "DeepSeek", "model": "deepseek-chat", "base_url": "https://api.deepseek.com",
  "api_key": "sk-...", "temperature": 0.4, "created": "2026-11-27" }
Provider model base_url
DeepSeek deepseek-chat https://api.deepseek.com
OpenAI gpt-4o-mini https://api.openai.com/v1
Alibaba Cloud qwen-plus, qwen-max https://dashscope.aliyuncs.com/compatible-mode/v1
OpenRouter any vendor/model https://openrouter.ai/api/v1

Other flags: --as black, --brief "an Italian" (skip the prompt), --engine PATH, --version.

In a game

you > e4                     a move, SAN or UCI
      hint                   ask Stockfish for a suggestion
      chat [text]            say something to the opponent, no board reload
      undo                   take back your move and its reply
      fen                    show the position
      coords                 toggle the a-h / 1-8 labels
      say                    toggle the opponent's commentary column
      eval                   toggle the eval / last / move panel
                             (all three are remembered for next time)
      new                    start a new game
      debug                  toggle raw model output
      help                   the command list
      quit                   leave, the game is saved

Moves: e4, Nf3, exd5, O-O, e8=Q, or UCI like e2e4.

The plan

Against an LLM, each game starts with one line from you:

brief > let us play the Italian, both sides develop normally

agreeing a plan...
plan: Italian: e4/e5, Nf3/Nc6, Bc4/Bc5; White builds c3/d3 and Nbd2, Black
      answers ...d6/...a6, both castle short.

The plan rides in the system prompt for the whole game; the model is told to follow it and to admit it when a move breaks it.

The eval

Stockfish over UCI, depth 15, centipawns from white's point of view. The right column shows the score and what the last move of each side was worth to the side that played it - the two lines are coloured like the pieces, white and red, so no labels are needed:

clichess in a game

The rightmost column is the opponent talking, prefixed with its nickname: one short line per turn - a taunt, a joke or a real thought - produced in the same request as the move, so it costs nothing extra. Every reply is capped: the say line at 12 words, a chat answer at about 180 characters, the pre-game plan at 240. chat lets you talk back - chat why not c5 or just chat to be asked.

Stockfish has nothing to say, so that column stays empty against it.

hint always asks the full-strength engine, never the handicapped opponent.

Each turn the model is asked for five candidate moves; Stockfish drops any that lose more than 0.8 pawns against the best option, and one survivor is picked at random. If the model fails three times in a row, Stockfish plays that move instead of the game dying.

Files

  • clichess.py — the whole program
  • install.sh / install.ps1 — the zero-dependency bootstraps
  • ~/.config/clichess/opponents/*.json — opponents
  • ~/.local/state/clichess/last.json — saved game

Tests

pip install -e .[dev]   # or: uv sync --extra dev
pytest -q               # 24 tests, no network, no engine needed

The suite covers move parsing, the candidate filter, the side panel, rendering toggles and the opponent store; m.ENGINE stays None throughout, so nothing is spawned. CI runs it on 3.10-3.13 (.github/workflows/tests.yml).

Notes

An LLM without search plays around 1000–1500 Elo: fine openings, tactical blunders later. It cannot play an illegal move — every legal move is enumerated locally and the reply is validated — but it can play badly.

License

MIT — see LICENSE. Built by Jude.

Metadata

Release files for clichess-cli 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for clichess-cli 0.9.0
File Interpreter ABI Platform Actions
clichess_cli-0.9.0-3-py3-none-any.whl Python 3 none any Details for clichess_cli-0.9.0-3-py3-none-any.whl

Release files / clichess_cli-0.9.0-3-py3-none-any.whl

Download URL clichess_cli-0.9.0-3-py3-none-any.whl
Size 23.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eee9e074b99c73eb5ae4e32373acb21abb2d5cfb3904194c32af2890e5495176
BLAKE2b-256 checksum
How to use checksums
045e4c162649781b1eb79f0b9cee11a5ffc75ac1b5767a612cb8d7f56195ab28
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for clichess-cli 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.9.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page