Skip to main content

Play international chess against AI opponents powered by local LLMs

Project description

LLM Chess

Play international chess against AI opponents powered by local large language models (LLMs).

Features

  • Interactive chess board with move highlighting and last-move indicators
  • Pawn promotion dialog
  • Undo moves support
  • FEN display and SAN move history
  • Dark theme Catppuccin-style UI
  • Game status detection (checkmate, stalemate, draw, etc.)

Supported LLM Backends

Connects to any OpenAI-compatible API endpoint:

Backend Default URL Notes
Ollama http://localhost:11434 ollama serve
llama.cpp Server http://localhost:8080 ./llama-server -m model.gguf --port 8080
LM Studio http://localhost:1234 Enable "Local Server" in Developer tab
Custom Any URL Configure in Settings

Installation

From DEB package (Ubuntu/Debian)

sudo dpkg -i llmchess_1.0.0_all.deb
llmchess

From source

# Install dependencies
pip install PyQt6 python-chess httpx

# Run
python3 main.py

Build DEB package

bash build_deb.sh
sudo dpkg -i llmchess_1.0.0_all.deb

Usage

  1. Start your LLM server (Ollama, llama.cpp, or LM Studio)
  2. Launch LLM Chess (llmchess or from application menu)
  3. Click Settings to configure your LLM connection
  4. Select White (you move first) or Black (AI moves first)
  5. Click a piece, then click the destination square to move

Settings

  • Provider: Select your backend (Ollama, llama.cpp, LM Studio, or Custom)
  • Base URL: API endpoint (auto-filled for presets)
  • Model: Model name to use
  • Temperature: Lower = more deterministic moves (default 0.3)
  • Max Tokens: Maximum response length (default 512)
  • Test Connection: Verify connectivity before playing

Project Structure

LLMChess/
├── main.py                    # Application entry point
├── requirements.txt           # Python dependencies
├── build_deb.sh              # DEB package build script
├── chess_app/
│   ├── board_widget.py       # Chess board UI (PyQt6)
│   ├── llm_connector.py      # LLM API connector
│   ├── game_controller.py    # Main window & game controller
│   └── settings_dialog.py    # LLM connection settings
└── deb_pkg/                  # DEB packaging files

How It Works

  1. Each turn, the current board state is sent to the LLM as a FEN string plus a list of legal moves in UCI format
  2. The LLM is prompted to respond with only one UCI move (e.g., e2e4, g1f3)
  3. The response is parsed to extract the UCI move and validated against legal moves
  4. If the LLM returns an invalid or empty response, the first legal move is used as fallback

Requirements

  • Python 3.9+
  • PyQt6
  • python-chess
  • httpx
  • A running LLM server (Ollama, llama.cpp, or LM Studio)

License

MIT License

Project details


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.0.0.tar.gz (14.6 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.0.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmchess-1.0.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmchess-1.0.0.tar.gz
Algorithm Hash digest
SHA256 34862bd544558e421ba30def20a5c14227dfa96b0baadd9f83e42a3be746829e
MD5 d8bdf1743e9961d9feacf29026e142b7
BLAKE2b-256 2a6eded4868c10da777589c543d85ee53900d93ba0d44bd4059d862d259687ef

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.0.0.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.0.0-py3-none-any.whl.

File metadata

  • Download URL: llmchess-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for llmchess-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b697f16aeff7a0215229af8c40473e123fe93fa0005e4a25ea4656fc3fed27ba
MD5 fc99be8490729a3a74189bc5c03af94a
BLAKE2b-256 dcacae6272fedda4c15862adeb0375a61ecde3768b11318c8a459ca0cc4c4ccc

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmchess-1.0.0-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.

Supported by

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