Documentation / Guides
Give an OpenAI or Anthropic model a chess engine
tool-calling definition and a budget guard
Tool definition
{
"name": "evaluate_position",
"description": "Evaluate a chess position with Stockfish. Returns the best move, evaluation in centipawns from White's view, and the top lines. Depth 14 is enough for move choice; use 20+ only when asked for deep analysis.",
"input_schema": {
"type": "object",
"properties": {
"fen": { "type": "string" },
"depth": { "type": "integer", "minimum": 1, "maximum": 22, "default": 14 },
"multipv": { "type": "integer", "minimum": 1, "maximum": 5, "default": 1 }
},
"required": ["fen"]
}
}
Budget guard
Models will happily ask for depth 30. In your tool handler, call GET /v1/price first and refuse anything over a per-call ceiling, returning the problem text to the model so it lowers the depth itself.
Get a key with one call: POST /v1/signup {"email":"you@example.com"}. Free plan, depth 14, 2,000 units a day.