Skip to main content

LLM Chess ๏ธ๐Ÿค–

Play chess against local LLMs, or watch two AIs battle each other โ€” all in a beautiful dark-themed GUI.

PyPI version npm version Python License: MIT GitHub release

LLM Chess is a desktop application that lets you play international chess against AI opponents powered by local or cloud large language models. Supports Ollama, llama.cpp, LM Studio, OpenAI GPT, DeepSeek, and any OpenAI-compatible API.

โœจ Features

๐ŸŽฎ Game Modes

  • Human vs AI โ€” Classic mode. Play as White or Black against an LLM.
  • AI vs AI โ€” Watch two LLMs play each other with configurable speed control (pause/resume/step).
  • Each side can use a different model, different backend, different temperature.

๐Ÿ’ญ AI Thinking Display

  • See the AI's reasoning process for every move
  • Color-coded by side (blue for White, pink for Black)
  • Parses Reasoning: and Move: format with fallback handling

๐ŸŽญ AI Personas

Choose the AI's "personality" โ€” affects its playing style and reasoning tone:

  • Default โ€” Calm, professional engine
  • Aggressive โ€” Loves attacks and sacrifices
  • Defensive โ€” Values king safety and solid positions
  • Creative โ€” Unusual openings and tactical surprises
  • Teacher โ€” Explains reasoning clearly, great for learning

๐ŸŽจ UI Highlights

  • Dark Catppuccin-themed PyQt6 interface
  • Click-to-move with legal-move highlighting
  • Last-move markers (yellow) and check indicators (red)
  • Full move history in SAN notation
  • Real-time FEN display
  • Promotion dialog (queen/rook/bishop/knight)
  • Undo moves

๐Ÿ“ฆ Installation

Option 1: pip (recommended)

pip install llmchess
llmchess

Or run as a module:

python -m llmchess

Option 2: npm (Node.js)

npm install -g llmchess
llmchess

The npm wrapper will auto-install the Python llmchess package on first run.

Option 3: DEB package (Ubuntu/Debian)

sudo dpkg -i llmchess_1.5.5_all.deb

The launcher will auto-install missing Python dependencies (PyQt6, python-chess, httpx).

Option 4: From source

git clone https://github.com/oemoem12/LLMChess.git
cd LLMChess
pip install -e .
python main.py

๐Ÿ”ง Setup LLM Backend

LLM Chess is backend-agnostic โ€” it speaks OpenAI-compatible HTTP API. Pick any one:

Ollama (easiest)

# Install from https://ollama.com
ollama pull qwen2.5:7b
ollama serve  # default: http://localhost:11434

llama.cpp

./llama-server -m model.gguf --port 8080

LM Studio

Open LM Studio โ†’ Developer tab โ†’ Start Local Server (default: http://localhost:1234)

๐Ÿš€ Quick Start

  1. Start your LLM server (Ollama/llama.cpp/LM Studio)
  2. Launch LLM Chess: llmchess
  3. Open Settings โ†’ select your backend โ†’ click Test Connection
  4. Choose a model in the connection settings
  5. Pick a game mode (Human vs AI / AI vs AI) and a persona
  6. Click a piece โ†’ click target square to move
  7. Watch the AI Thinking panel to see your opponent's reasoning

๐ŸŽฌ Screenshots

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Game Mode          โ”‚  Move History    โ”‚
โ”‚  [Human vs AI โ–ผ]    โ”‚  1. e4 e5        โ”‚
โ”‚  [White (first) โ–ผ]  โ”‚  2. Nf3 Nc6      โ”‚
โ”‚                     โ”‚  3. Bb5 a6       โ”‚
โ”‚  โ™” โ™• โ™– โ™— โ™˜ โ™™        โ”‚  ...             โ”‚
โ”‚  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚                  โ”‚
โ”‚  Chess Board        โ”‚  AI Thinking     โ”‚
โ”‚  (8ร—8)              โ”‚  โ”โ”โ” White AI โ”โ” โ”‚
โ”‚  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”‚  Move: e2e4      โ”‚
โ”‚  [New Game] [โš™ Set] โ”‚  Reasoning:      โ”‚
โ”‚                     โ”‚  Classical king  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ Tech Stack

  • PyQt6 โ€” Cross-platform GUI
  • python-chess โ€” Chess rules, FEN/PGN handling
  • httpx โ€” OpenAI-compatible HTTP client
  • setuptools + Trusted Publisher โ€” Zero-token PyPI release

๐Ÿ“ Architecture

chess_app/
โ”œโ”€โ”€ __init__.py            # Package entry, version, main()
โ”œโ”€โ”€ __main__.py            # python -m chess_app support
โ”œโ”€โ”€ main.py                # GUI entry point
โ”œโ”€โ”€ board_widget.py        # Chess board renderer (PyQt6)
โ”œโ”€โ”€ game_controller.py     # Main window + game flow + AI vs AI logic
โ”œโ”€โ”€ llm_connector.py       # OpenAI-compatible LLM client + persona prompts
โ””โ”€โ”€ settings_dialog.py     # Tabbed config UI (White/Black sides)

๐Ÿค Contributing

PRs welcome! Some ideas:

  • Save/load PGN files
  • Tournament mode (round-robin between N models)
  • Stockfish-LLM hybrid (use Stockfish for blunders, LLM for variety)
  • Post-game analysis with LLM commentary
  • Online multiplayer via WebSocket

๐Ÿ“œ License

MIT โ€” do whatever you want, just don't blame me if the AI hangs your king.

๐Ÿ”— Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llmchess-1.5.6.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llmchess-1.5.6-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file llmchess-1.5.6.tar.gz.

File metadata

  • Download URL: llmchess-1.5.6.tar.gz
  • Upload date:
  • Size: 25.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmchess-1.5.6.tar.gz
Algorithm Hash digest
SHA256 c198d6076c0a96f9f935335dc67f95134dc860ea17eb01b25867fd550384ef60
MD5 229c0ace1508bcb162e2e75470032162
BLAKE2b-256 84fbb3109d9cccd072a4282ebbe4b6737fb1c9c425ce2527b2e3e084a9ca60d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.5.6.tar.gz:

Publisher: publish.yml on oemoem12/LLMChess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmchess-1.5.6-py3-none-any.whl.

File metadata

  • Download URL: llmchess-1.5.6-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for llmchess-1.5.6-py3-none-any.whl
Algorithm Hash digest
SHA256 d76849251045592719b37a6662b47f99830336bc0a78103d5d0e4a4688926727
MD5 b146c8e5829519e7c330db0ba12f02d3
BLAKE2b-256 9b8a4bb201552db31ae51200738ee931a7ee22fdeb80cee12dcfb5d98efa5968

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.5.6-py3-none-any.whl:

Publisher: publish.yml on oemoem12/LLMChess

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.5.6 This release

2 files

1.5.0

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page