# Explain Describe a whole position in words, with its pawn structure, who stands better and each side's plans. A short explanation of a position, for a study tool, an annotated game or a puzzle's solution. It is a [Recipe](/docs/recipes): copy it, then change the prompt to suit your app. **Calls:** one Generate call, on Queen here, about $0.02; on Knight, about $0.002. ## The prompt and the request An explanation describes a position as a whole: the pawn structure, who stands better, and each side's plans. It suits a study tool, an annotated game or a puzzle's solution. This one uses Queen, the stronger Model, for a richer answer; Knight works too and costs less. **Reading `lines`:** in an explanation a Line is a plan rather than a forced sequence, so it includes the other side's likely replies. Show it as a link that plays the plan on the board, and leave the position where the plan ends so the reader can see the result. ```text System prompt Explain this position to a club player in under 150 words. Cover the pawn structure, who stands better and why, and one plan for each side. Show each plan as a short sequence of moves from the current position. Judge positions in words, such as "White is slightly better", never in numbers. ``` ```bash curl curl https://api.chessdrive.io/v1/generate \ -H "Authorization: Bearer $CHESSDRIVE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "queen-1", "system": "Explain this position to a club player in under 150 words.\nCover the pawn structure, who stands better and why, and one plan for each side.\nShow each plan as a short sequence of moves from the current position.\nJudge positions in words, such as \"White is slightly better\", never in numbers.", "position": { "fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2N1P3/PPQ2PPP/R3KBNR w KQ - 3 8" }, "messages": [{ "role": "user", "content": "Explain this position." }] }' ``` ```python Python import os import requests EXPLAIN = """Explain this position to a club player in under 150 words. Cover the pawn structure, who stands better and why, and one plan for each side. Show each plan as a short sequence of moves from the current position. Judge positions in words, such as "White is slightly better", never in numbers.""" r = requests.post( "https://api.chessdrive.io/v1/generate", headers={"Authorization": f"Bearer {os.environ['CHESSDRIVE_API_KEY']}"}, json={ "model": "queen-1", "system": EXPLAIN, "position": {"fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2N1P3/PPQ2PPP/R3KBNR w KQ - 3 8"}, "messages": [{"role": "user", "content": "Explain this position."}], }, ) r.raise_for_status() reply = r.json() print(reply["content"]) for line in reply["lines"]: print(line["id"], "ends at", line["moves"][-1]["fen"]) ``` ```js JavaScript const EXPLAIN = `Explain this position to a club player in under 150 words. Cover the pawn structure, who stands better and why, and one plan for each side. Show each plan as a short sequence of moves from the current position. Judge positions in words, such as "White is slightly better", never in numbers.`; const res = await fetch("https://api.chessdrive.io/v1/generate", { method: "POST", headers: { Authorization: `Bearer ${process.env.CHESSDRIVE_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: "queen-1", system: EXPLAIN, position: { fen: "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2N1P3/PPQ2PPP/R3KBNR w KQ - 3 8" }, messages: [{ role: "user", content: "Explain this position." }], }), }); if (!res.ok) throw new Error(await res.text()); const reply = await res.json(); console.log(reply.content); for (const line of reply.lines) console.log(line.id, "ends at", line.moves.at(-1).fen); ``` ```json Response { "id": "req_01M4G5R3T9BW6K2XN8DQ4VJE7F", "model": "queen-1", "content": "This is the Carlsbad structure from the Queen's Gambit Declined Exchange: White's pawns on d4 and e3 face Black's on d5 and c6, and the half-open c-file belongs to White. White is slightly better, with easier plans and a lead in development.\n\nWhite's classic plan is the minority attack: [Bd3, Rb1 and b4](line:L1), then b5 to break up Black's queenside and leave a weak pawn on c6. A sharper plan is [Nge2, castling and f3](line:L2), preparing e4 to open the centre.\n\nBlack's counterplay is on the kingside: one knight eyes e4, the other heads for g6 via f8, and Black keeps the queenside pawns where they are for as long as possible.", "lines": [ { "id": "L1", "from_fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2N1P3/PPQ2PPP/R3KBNR w KQ - 3 8", "moves": [ { "san": "Bd3", "uci": "f1d3", "fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/R3K1NR b KQ - 4 8" }, { "san": "Nbd7", "uci": "b8d7", "fen": "r1bq1rk1/pp1nbppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/R3K1NR w KQ - 5 9" }, { "san": "Rb1", "uci": "a1b1", "fen": "r1bq1rk1/pp1nbppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/1R2K1NR b K - 6 9" }, { "san": "Re8", "uci": "f8e8", "fen": "r1bqr1k1/pp1nbppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/1R2K1NR w K - 7 10" }, { "san": "b4", "uci": "b2b4", "fen": "r1bqr1k1/pp1nbppp/2p2n2/3p2B1/1P1P4/2NBP3/P1Q2PPP/1R2K1NR b K - 0 10" } ] }, { "id": "L2", "from_fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2N1P3/PPQ2PPP/R3KBNR w KQ - 3 8", "moves": [ { "san": "Bd3", "uci": "f1d3", "fen": "rnbq1rk1/pp2bppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/R3K1NR b KQ - 4 8" }, { "san": "Re8", "uci": "f8e8", "fen": "rnbqr1k1/pp2bppp/2p2n2/3p2B1/3P4/2NBP3/PPQ2PPP/R3K1NR w KQ - 5 9" }, { "san": "Nge2", "uci": "g1e2", "fen": "rnbqr1k1/pp2bppp/2p2n2/3p2B1/3P4/2NBP3/PPQ1NPPP/R3K2R b KQ - 6 9" }, { "san": "Nbd7", "uci": "b8d7", "fen": "r1bqr1k1/pp1nbppp/2p2n2/3p2B1/3P4/2NBP3/PPQ1NPPP/R3K2R w KQ - 7 10" }, { "san": "O-O", "uci": "e1g1", "fen": "r1bqr1k1/pp1nbppp/2p2n2/3p2B1/3P4/2NBP3/PPQ1NPPP/R4RK1 b - - 8 10" }, { "san": "Nf8", "uci": "d7f8", "fen": "r1bqrnk1/pp2bppp/2p2n2/3p2B1/3P4/2NBP3/PPQ1NPPP/R4RK1 w - - 9 11" }, { "san": "f3", "uci": "f2f3", "fen": "r1bqrnk1/pp2bppp/2p2n2/3p2B1/3P4/2NBPP2/PPQ1N1PP/R4RK1 b - - 0 11" } ] } ], "finish_reason": "end", "usage": { "input_tokens": 1380, "output_tokens": 172, "cached_tokens": 0, "grounding_tokens": 1170, "reasoning_tokens": 0 }, "cost_usd": "0.013440" } ```