chess-cli tracks a standard chess game while a human moves pieces on a physical board and an LLM supplies moves through an OpenAI-compatible API.
- Ollama, OpenAI, or another server exposing
POST /v1/chat/completions - A model name
For OpenAI, set the API key in the environment before starting the program:
$env:OPENAI_API_KEY = "your-key"API keys are never stored in the application config file.
Ollama is the default provider and the LLM plays black by default:
chess-cli --model gemma4:31bUse OpenAI and have the model open as white:
chess-cli --provider openai --model your-model --llm-color whiteChoose the model's reasoning level for this run (the default is medium):
chess-cli --reasoning-effort highPrint the model's raw reasoning and response before each move:
chess-cli --model gemma4:31b --debugUse any OpenAI-compatible endpoint:
chess-cli --provider compatible --url http://localhost:8080/v1 --model local-modelLoad a game and automatically save it when the game ends:
chess-cli --provider ollama --model gemma4:31b --load game.pgn --save finished.pgnRun chess-cli --help for all startup options.
Enter a legal move in Standard Algebraic Notation, such as e4, Nf3, O-O, or Qh4#. The configured LLM color moves automatically after a human move. Model responses are checked against the legal moves; an invalid response is retried up to three times without changing the board.
Interactive commands:
/moveasks the LLM to make exactly one move for the current side, then returns to the prompt. This supports switching sides or manually advancing LLM-vs-LLM play./boarddisplays the current ASCII board./save [path]saves the current game..pgnwrites PGN;.txtand extensionless paths write numbered SAN movetext./newstarts over after confirming any unsaved moves can be discarded./provider ollama|openai|compatibleswitches provider./model <id>changes the current provider's model./url <uri>changes the current provider's API base URL./reasoning <low|medium|high>changes and saves the current provider's reasoning level./helpshows command help./quitexits, confirming first if moves have not been saved.
Changes made with /provider, /model, /url, and /reasoning are persisted as per-provider profiles under the user's application-data directory at chess-cli/config.json. Startup arguments override those preferences for one run only.