Work in progress Stockfish REST API
making this for my own chess discord bots and other chess software that need stockfish best moves within 3 seconds. (I'm NOT trying to sell this or whatever in the name of Stockfish), mostly used for internal software, and of course it be free if I deploy it for other devs!!
- Stockfish.wsm
- The Stockfish developers (see AUTHORS file). Stockfish [Computer software]. https://github.com/official-stockfish/Stockfish (thanks to everyone! Truly genius devs out there)
- Stockfish js for understanding the flow [moving it to the server rather than node dependency]
- Stockfish standalone nodejs server, I used this for some help, not really but you get the point
- fen-validator so I don't need to do all that FEN regex stuff
- running on debug mode which runs the engine on server start by selecting engine mode (wasm or cc-nonnue) or run help to see server commands
node server.js debug wasm
-
node server.js debug cc-nonnue
node server.js debug cc-yesnnue
node server --help
- running without debug mode and starting the server
node server.js
- mode = run webassembly Stockfish (wasm) or No NNUE ChessCom Stockfish 16 (cc-nonnue) or Yes NNUE ChessCom Stockfish 16 (cc-yesnnue)
- depth = for wasm implementation [1 to 20] for Chesscom Stockfish 16 no NNUE version [1 to 16], for ChessCom Stockfish 16 yes NNUE version [1 to 22+] cap at depth 22, if one needs more they can request it
- fen = chess FEN for given position
- Get best move for current FEN and MODE (pass in engine mode [wasm, cc-nonnue])
GET localhost:5000/stockfish/bestmove?fen=rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2
- Get eval for current FEN and MODE(pass in engine mode [wasm, cc-nonnue])
GET localhost:5000/stockfish/eval?fen=rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2
- Get top engine line and depth info for given engine MODE and DEPTH and FEN
GET localhost:5000/stockfish/toplines?fen=rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2&depth=20&mode=wasm
GET localhost:5000/stockfish/toplines?fen=rnbqkbnr/pppp1ppp/4p3/8/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2&depth=16&mode=16
- add NNUE engine type to bestmove (fixed needs review)
- add NNUE engine type to eval (fixed needs review)
- add NNUE engine type to lines (buggy code)
- change lines to pv
follows same as Stockfish GPL