API reference
Four chess APIs: Generate (Knight, Queen), Embed (the Embedding model), Engine (Stockfish, with Lc0 coming soon) and Search (the Games database, with similar moments coming soon), and the Usage API to see what they cost you.
The whole contract, which this page is built from, is an OpenAPI 3.1 file at /openapi.yaml.
Authentication
Authorization: Bearer ck_…. Keys are ck_ + 43 base62 characters + a 6-character base62 CRC32
checksum. Shown once at creation. Server-side use only.
Errors
Every error answers with the same JSON envelope, and only 2xx responses are billed. Each endpoint lists its statuses and their codes.
typestring requiredOne oferror.errorobject requirederror.typestring requiredOne ofinvalid_request_error,authentication_error,billing_error,permission_error,not_found_error,rate_limit_error,api_error,overloaded_error.error.codestring requiredA stable machine-readable code; see each response for the list.
error.messagestring requiredFor humans; may change. Never contains provider text.
error.paramstringThe request field at fault, as a path:
position.fen,input[3].text.error.resets_atstringWhen the refusal lifts, RFC 3339 in UTC, such as the end of a Key limit's period on
key_limit_reached, or when the next Queen call frees up onplan_required.request_idstring requiredSame value as the
request-idheader.
Generate
POST/v1/generate streams with stream: true
Ask Knight or Queen, optionally about a position, and get prose with its named moves checked.
Stateless: send the whole conversation each time. The reply is markdown. Every move it names comes back as a
Line, which the prose links as [text](line:L1); a Line is cut at its first illegal move, so every move in
lines is legal. Without a position, lines is empty. Coaching, explaining and picking a move are Recipes
in the Docs, not APIs. With stream: true the response is Server-Sent Events (see GenerateStreamEvent).
Request body
modelstring requiredKnight or Queen: a versioned Model ID (
knight-1,queen-1) or an alias for the latest version (knight,queen). The Embedding model isinvalid_field.systemstringInstructions for the Model, ahead of the conversation.
messagesarray of objects requiredThe whole conversation, alternating
userandassistant, ending withuser.messages[].rolestring requiredOne ofuser,assistant.messages[].contentstring requiredMarkdown. Assistant turns are sent back as received,
line:links included.positionobjectThe position the conversation is about. Without one,
linesis always empty.position.fenstringA position in Forsyth–Edwards Notation.
position.pgnstringA game in PGN. Only its main line counts; variations and comments are ignored. The main line holds at most 1,000 half-moves, and one request sends at most 256 KB of PGN, each distinct PGN counted once.
position.plyintegerHalf-moves into the PGN's main line; 0 is the start position.
max_tokensintegerThe most output tokens to generate, up to the Model's output cap: 3,072 on Knight, 4,096 on Queen. Left out, it is 1,024 on Knight and 4,096 on Queen, whose reasoning can't be turned off. Over the cap is
invalid_field. Estimated input plusmax_tokensover the Model's context window iscontext_too_long, never silently clamped. Reasoning counts toward it, so a lowmax_tokenscan cut the reply short or leave no room for it. A reply with no text isupstream_unavailable, unbilled.temperaturenumberDefault1.streambooleanDefaultfalse.
Response
idstring requiredSame value as the
request-idheader.modelstring requiredThe versioned Model ID that served the request.
contentstring requiredMarkdown; Lines are referenced as
[text](line:L1). Aline:link with no matching Line is plain text.linesarray of objects requiredlines[].idstring requiredReferenced from the prose as
[text](line:<id>).lines[].from_fenstring requiredA position in Forsyth–Edwards Notation.
lines[].movesarray of objects requiredfinish_reasonstring requiredendwhen the Model finished,max_tokenswhen it was cut off there.One ofend,max_tokens.usageobject requiredGenerate is priced in tokens: every token the Model processes is billed, including the grounding we add and its reasoning.
cached_tokensandgrounding_tokensare part ofinput_tokens, andreasoning_tokensis part ofoutput_tokens; each is 0 when there is none.usage.input_tokensinteger requiredEvery input token, cached and grounding included.
usage.output_tokensinteger requiredEvery output token, reasoning included.
usage.cached_tokensinteger requiredInput tokens read from cache (the conversation history a client resends), billed at the cached-input price.
usage.grounding_tokensinteger requiredInput tokens we added to ground the Model in the position, billed as input.
usage.reasoning_tokensinteger requiredOutput tokens the Model spent reasoning before it answered, billed as output.
cost_usdstring requiredWhat this call drew from the Balance, as a decimal string in dollars.
Errors
- 400
invalid_request_error. Codes:invalid_json,missing_field,invalid_field,unknown_model,invalid_fen,invalid_pgn,invalid_ply,context_too_long(Generate),too_many_inputsandtext_too_long(Embed),unknown_engine,unknown_network,limit_too_highandgame_over(Engine).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 402
billing_error: the call was refused for money, not speed. Codes:insufficient_balance(the Balance is used up, or has never held credits),spend_limit_reached(the Account's Spend limit for this month),key_limit_reached(this API key's Key limit for its period, withresets_at).- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 413
invalid_request_error. Code:request_too_large(the body is over 16 MB, or took over 30 seconds to arrive).- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.- 503
overloaded_error. Code:upstream_unavailable. Retry with backoff.
curl https://api.chessdrive.io/v1/generate \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "knight",
"system": "You are a patient chess coach for a 1400-rated player.",
"position": {"pgn": "1. e4 c5 2. Nf3 d6 3. d4 cxd4 4. Nxd4 Nf6 5. Nc3 a6", "ply": 10},
"messages": [{"role": "user", "content": "What is the idea behind 5...a6?"}]
}'Embed
POST/v1/embed
Turn positions and texts into vectors in one space.
Up to 256 items per call, positions and texts mixed in any order, each typed. Vectors compare only within one
Embedding model version, so model takes a versioned ID and never an alias. One bad item rejects the whole
call, with param naming it (input[3].fen).
Request body
modelstring requiredA versioned Embedding model ID. There is no alias: vectors compare only within one version. Any other name, Knight and Queen included, is
unknown_model.inputarray of objects required1 to 256 items, positions and texts mixed in any order. Over 256 is
too_many_inputs.input[].typestringOne oftext.input[].fenstringA position in Forsyth–Edwards Notation.
input[].pgnstringA game in PGN. Only its main line counts; variations and comments are ignored. The main line holds at most 1,000 half-moves, and one request sends at most 256 KB of PGN, each distinct PGN counted once.
input[].plyintegerHalf-moves into the PGN's main line; 0 is the start position.
input[].textstringOn Embed, at most 77 tokens, about 300 characters. On Search, at most 1,000 characters. Never truncated (
text_too_longon Embed,query_too_longon Search). Empty or whitespace-only text isinvalid_field.encoding_formatstringbase64gives each vector's bytes in base64: little-endian float32 numbers, one signed byte per number underprecisionint8, or the packed bits underbinary.One offloat,base64.Default"float".dimensionsintegerHow long each vector is. A shorter vector is the first numbers of the full one, at unit length again:
chessdrive-embed-1puts the most useful dimensions first, so it costs a little recall for a much smaller file. The price is the same.One of64,128,256,512.Default512.precisionstringHow each number is stored.
int8is an integer from -127 to 127, one byte each.binaryis each number's sign, 1 for zero or above, packed 8 to a byte with the first dimension in the high bit:dimensions/ 8 integers from 0 to 255. Compare int8 vectors by cosine and binary ones by Hamming distance. The price is the same.One offloat32,int8,binary.Default"float32".
Response
idstring requiredSame value as the
request-idheader.modelstring requireddimensionsinteger requiredEach vector's length in dimensions: the request's
dimensions, or 512 forchessdrive-embed-1. A binary vector holdsdimensions/ 8 bytes.dataarray of objects requiredOne vector per item, in request order. A float32 vector is L2-normalised.
data[].indexinteger requiredThe item's place in
input.data[].embeddingarray of numbers or string requiredA list of numbers, integers under
precisionint8orbinary, or a base64 string underencoding_formatbase64.usageobject requiredItems by kind, each with its own price; both are always present.
usage.positionsinteger requiredusage.textsinteger requiredcost_usdstring requiredWhat this call drew from the Balance, as a decimal string in dollars.
Errors
- 400
invalid_request_error. Codes:invalid_json,missing_field,invalid_field,unknown_model,invalid_fen,invalid_pgn,invalid_ply,context_too_long(Generate),too_many_inputsandtext_too_long(Embed),unknown_engine,unknown_network,limit_too_highandgame_over(Engine).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 402
billing_error: the call was refused for money, not speed. Codes:insufficient_balance(the Balance is used up, or has never held credits),spend_limit_reached(the Account's Spend limit for this month),key_limit_reached(this API key's Key limit for its period, withresets_at).- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 413
invalid_request_error. Code:request_too_large(the body is over 16 MB, or took over 30 seconds to arrive).- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.- 501
api_error. Code:coming_soon: the API, or theengineyou named (withparam: engine), is listed but isn't open yet. Refused straight after the key check, so it is never billed and counts toward no rate limit. Its opening is announced in the Changelog.- 503
overloaded_error. Code:upstream_unavailable. Retry with backoff.
curl https://api.chessdrive.io/v1/embed \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "chessdrive-embed-1",
"input": [{"type": "position", "fen": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1"}, {"type": "text", "text": "an isolated queen'\''s pawn"}]
}'Search
POST/v1/search
Every move played from a position, one player's games, or the positions a filter holds for.
Search answers from real games, in one of three modes, exactly one a call. position gives
every move played from it, most played first, with how those games ended: one query, $5 per 1,000. player
gives that player's games, newest first: $5 per 1,000 games returned, at least one a call, and nothing for a
name that could be several players, which answers their candidates. where takes a Position filter and
gives the Positions it holds for, each with how often games reached it, whether it is quiet, and the
highest-rated game that reaches it: $5 per 1,000 Positions returned, at least one a call. A filter that is
wrong is 400 invalid_filter, unbilled, with param naming the node at fault; one that runs too long is 503
upstream_unavailable, unbilled: narrow it. No answer names where a game came from. Search by similar
moments, with query, is coming soon: it answers 501 coming_soon, unbilled.
Request body
positionobjectEvery move played from this Position in the Games database, most played first.
position.fenstringA position in Forsyth–Edwards Notation.
position.pgnstringA game in PGN. Only its main line counts; variations and comments are ignored. The main line holds at most 1,000 half-moves, and one request sends at most 256 KB of PGN, each distinct PGN counted once.
position.plyintegerHalf-moves into the PGN's main line; 0 is the start position.
playerobjectThe player whose games to find.
player.fide_idintegerA player on FIDE's list.
player.namestringA name as FIDE's list writes it, "Carlsen, Magnus", case ignored. A name that could be several players answers their
candidates.whereobjectA Position filter: a test, true or false for each Position, whose Positions the answer holds. Board expressions give a set of squares:
{"piece": "wN"}(worb, thenP N B R Q K),{"attacks": "wB"}or{"attacks": "white"}(own pieces count as attacked),{"occupied": "white" | "black" | "any"},{"squares": ["g8", "h7"]},{"rank": 7},{"file": "a"},and,orandnot,{"shift": [X, "N"]}(one step: N S E W NE NW SE SW),{"fill": [X, "N"]}(1 to 7 steps), and{"flip": X}(colours swapped, ranks mirrored). Tests:{"any": X},{"none": X},{"count": X, "gte" | "lte" | "eq": n},{"to_move": "white" | "black"},{"castling": "K" | "Q" | "k" | "q"},{"en_passant": true}or{"en_passant": X},all,some,notandflip, and{"ref": name}for a part named indefine. Each node is one key. A wrong filter isinvalid_filter, withparamat the node; past 2,000 nodes or 64 levels once refs are replaced, it is too big.defineobjectWith
where: named parts of the filter, each a board expression or a test, used as{"ref": name}. A part may use others, never itself.limitintegerWith
player, how many games at most (default 50); withwhere, how many Positions (default 20).limit_too_highpast 200.cursorstringWith
playerorwhere: the last answer'snext_cursor, for the next page, sent with the sameplayerandfilters, or the samewhereanddefine. Opaque. A cursor from before the games were rebuilt iscursor_expired.pgnbooleanWith
player: each game carries its PGN.Defaultfalse.filtersobjectAll optional, combined with AND.
date,ecoandresultmean the same in both modes.rating,speedandplayerare for a query (coming soon, and not promised), andcolorandopponentfor a player's games; sent in the other mode, or withposition, they areinvalid_field.filters.dateobjectWhen the game was played, by month, both ends included.
filters.ecoarray of stringsECO codes or prefixes (
B90,C4,E).filters.resultarray of stringsThe game's result, from White's side as PGN writes it.
filters.colorstringThe side the player had.
One ofwhite,black.filters.opponentobjectThe other side, by FIDE ID.
Response
idstringSame value as the
request-idheader.fenstringA position in Forsyth–Edwards Notation.
movesarray of objectsEmpty when no stored game reaches the Position.
moves[].ucistring requiredmoves[].sanstring requiredmoves[].countinteger requiredHow many games played it.
moves[].white_winsinteger requiredmoves[].drawsinteger requiredmoves[].black_winsinteger requiredusageobjectusage.queriesintegerAlways 1.
usage.gamesintegerThe true count. The bill counts at least one game, except on an ambiguous name, which is free.
usage.positionsintegerThe true count. The bill counts at least one Position.
cost_usdstringWhat this call drew from the Balance, as a decimal string in dollars.
matchstringfide: one player on FIDE's list, with their games.ambiguous: a name that could be several, incandidates, with no games and nothing billed.One offide,ambiguous.playerobject or nullNull on an ambiguous name.
player.fide_idintegerplayer.namestringplayer.federationstring or nullplayer.titlestring or nullplayer.ratingsobjectThe player's ratings on FIDE's list, null when they have none.
player.birth_yearinteger or nullcandidatesarray of objectsOn an ambiguous name, the players it could be. Call again with one's
fide_id. Empty otherwise.candidates[].fide_idinteger requiredcandidates[].namestring requiredcandidates[].federationstring or null requiredcandidates[].titlestring or null requiredcandidates[].ratingsobject requiredThe player's ratings on FIDE's list, null when they have none.
gamesarray of objectsNewest first.
games[].colorstring requiredThe side the player had.
One ofwhite,black.games[].gameobject requiredOne game, the same in a Moment and among a player's games.
next_cursorstring or nullSend as
cursor, with the samewhereanddefine, for the next page. Null on the last page. It expires when the games are rebuilt.positionsarray of objectsEmpty when the filter holds for no stored Position.
positions[].fenstring requiredA position in Forsyth–Edwards Notation.
positions[].occurrencesinteger requiredHow many times the games reach it.
positions[].quietboolean requiredThe side to move is out of check and has no capture or promotion that wins material.
positions[].examplesarray of objects requiredThe highest-rated game that reaches it, without its moves.
Errors
- 400
invalid_request_error. Codes:invalid_json,missing_field,invalid_field,unknown_model,invalid_fen,invalid_pgn,invalid_ply,context_too_long(Generate),too_many_inputsandtext_too_long(Embed),unknown_engine,unknown_network,limit_too_highandgame_over(Engine).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 402
billing_error: the call was refused for money, not speed. Codes:insufficient_balance(the Balance is used up, or has never held credits),spend_limit_reached(the Account's Spend limit for this month),key_limit_reached(this API key's Key limit for its period, withresets_at).- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 413
invalid_request_error. Code:request_too_large(the body is over 16 MB, or took over 30 seconds to arrive).- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.- 501
api_error. Code:coming_soon: the API, or theengineyou named (withparam: engine), is listed but isn't open yet. Refused straight after the key check, so it is never billed and counts toward no rate limit. Its opening is announced in the Changelog.- 503
overloaded_error. Code:upstream_unavailable. Retry with backoff.
curl https://api.chessdrive.io/v1/search \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"position": {"fen": "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 0 1"}
}'Engine
POST/v1/engine streams with stream: true
Analyse a position, a list of positions or a whole game, with Stockfish.
At most one limit (depth, nodes or movetime_ms) under the engine's cap, or the engine's default. Every
call also stops at a 60 s wall-clock cap and returns the deepest completed result. Scores are from White's
point of view. Engine takes no model; billing is by Engine time, at least 100 ms a call. With
stream: true the response is Server-Sent Events, one per completed depth (see EngineStreamEvent).
A whole game: a position that is a pgn with no ply runs Engine on every position of the PGN's main
line and answers with an EngineGameResponse, one entry per move. The limit applies to each position, and
the default is depth 14 rather than 20. The whole game shares the one 60 s budget: a movetime_ms that
can't fit is refused up front, and a game that runs past it fails with limit_too_high and is not billed.
It is billed by the Engine time of all its positions together, at least 100 ms. A whole game takes no
lines (each move gets Engine's best Line) and no stream.
A list of positions: positions, instead of position, takes up to 100 and answers with an
EngineBatchResponse, one result per position in order. It counts as one request and one in flight. The
limit and lines apply to each position, the default is depth 14 rather than 20, and each Line is cut to
its first 8 half-moves. The positions run one after another inside the one 60 s budget. A position Engine can't
take refuses the whole call, naming it, and nothing is billed. A finished game comes back as game_over and
doesn't stop the others. At the budget, or when the engine fails part way, the call still answers 200: what
finished is billed, and the rest comes back as not_run, unbilled, to send again. If nothing finished, it is
the usual error, unbilled. Billing is the Engine time of all its positions together, at least 100 ms. A list
takes no stream.
A burst: a call over the Plan's requests in flight waits up to 5 s for one to finish before it answers
429 rate_limited.
Request body
enginestring requiredAny other name is
unknown_engine.One ofstockfish,lc0.positionobjectA position, as the other APIs take it (a FEN, or a PGN plus
ply), or a whole game: a PGN with noplyruns Engine on every position of its main line.position.fenstringA position in Forsyth–Edwards Notation.
position.pgnstringA game in PGN. Only its main line counts; variations and comments are ignored. The main line holds at most 1,000 half-moves, and one request sends at most 256 KB of PGN, each distinct PGN counted once.
position.plyintegerHalf-moves into the PGN's main line; 0 is the start position.
positionsarray of objects1 to 100 positions to analyse in one call, instead of
position. Over 100 istoo_many_inputs.positions[].fenstringA position in Forsyth–Edwards Notation.
positions[].pgnstringA game in PGN. Only its main line counts; variations and comments are ignored. The main line holds at most 1,000 half-moves, and one request sends at most 256 KB of PGN, each distinct PGN counted once.
positions[].plyintegerHalf-moves into the PGN's main line; 0 is the start position.
depthintegerStockfish only (
invalid_fieldon Lc0). Stockfish's default isdepth20 on a position and 14 on each position of a whole game or a list. On a whole game leave it out: atdepth20 a game of 25 moves or more passes the 60 s a call has and fails aslimit_too_high.nodesintegerAt most 1,000,000,000 on Stockfish and 2,000,000 visits on Lc0, whose default is
nodes10,000.movetime_msintegerlinesintegerHow many ranked Lines to return. A whole game takes only 1.
Default1.networkstringLc0's network:
bt4(the default),t82ort1-256. Only Lc0 takes one; on Stockfish it isinvalid_field.One ofbt4,t82,t1-256.streambooleanNot on a whole game or a list of positions.
Defaultfalse.
Response
idstringSame value as the
request-idheader.enginestringStockfish, or Lc0, which is coming soon; a call naming
lc0returns 501coming_soon.One ofstockfish,lc0.versionstringnetworkstring or nullThe Network Lc0 ran; null on Stockfish.
fenstringA position in Forsyth–Edwards Notation.
depthintegerseldepthintegernodesintegertime_msintegerbest_moveobjectbest_move.sanstring requiredbest_move.ucistring requiredlinesarray of objectslines[].rankinteger requiredlines[].depthinteger requiredlines[].cpinteger or null requiredCentipawns.
lines[].mateinteger or null requiredMoves to mate; positive means White mates.
lines[].wdlobject requiredWin, draw and loss chances for White, per mille.
lines[].movesarray of objects requiredstop_reasonstringlimitwhen the requested limit was reached,time_capwhen the time cap stopped it.One oflimit,time_cap.usageobjectEngine time, the engine's own search time on every
okposition together. The bill counts at least 100 ms.usage.engine_msintegercost_usdstringWhat this call drew from the Balance, as a decimal string in dollars.
movesarray of objectsmoves[].plyinteger requiredThe position the move was played from, as
{pgn, ply}names it: 0 for White's first move. Send it as thepositionof a Generate call to talk about this move.moves[].move_numberinteger requiredThe move's number, as a PGN writes it.
moves[].colorstring requiredOne ofwhite,black.moves[].moveobject requiredmoves[].fenstring requiredA position in Forsyth–Edwards Notation.
moves[].eval_beforeobject requiredA position's evaluation from White's point of view. Exactly one of
cpandmateis set;mate0 is a checkmate on the board, andwdlsays who won.moves[].eval_afterobject requiredA position's evaluation from White's point of view. Exactly one of
cpandmateis set;mate0 is a checkmate on the board, andwdlsays who won.moves[].win_chance_lostnumber requiredThe win chance the move lost for the side that played it, on Lichess's scale from -1 to +1:
2 / (1 + exp(-0.00368208 × cp)) - 1, and ±1 for a mate. 0 when it lost none.moves[].verdictstring requiredHow good the move was, by the win chance it lost for the side that played it, the way Lichess judges:
bestis Engine's own best move; otherwise 0.3 or more lost is ablunder, 0.2 amistake, 0.1 aninaccuracy, and less isgood.One ofbest,good,inaccuracy,mistake,blunder.moves[].best_linearray of objects requiredEngine's best Line from
fen, its first 8 half-moves at most;eval_beforeis its score. For the whole Line or more Lines, call Engine on{pgn, ply}.resultsarray of objectsresults[].statusstring requiredOne ofok,game_over,not_run.results[].fenstring requiredA position in Forsyth–Edwards Notation.
results[].depthintegerresults[].seldepthintegerresults[].nodesintegerresults[].time_msintegerresults[].stop_reasonstringlimitwhen the requested limit was reached,time_capwhen the time cap stopped it.One oflimit,time_cap.results[].best_moveobjectresults[].linesarray of objectsThe ranked Lines, each its first 8 half-moves at most.
Errors
- 400
invalid_request_error. Codes:invalid_json,missing_field,invalid_field,unknown_model,invalid_fen,invalid_pgn,invalid_ply,context_too_long(Generate),too_many_inputsandtext_too_long(Embed),unknown_engine,unknown_network,limit_too_highandgame_over(Engine).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 402
billing_error: the call was refused for money, not speed. Codes:insufficient_balance(the Balance is used up, or has never held credits),spend_limit_reached(the Account's Spend limit for this month),key_limit_reached(this API key's Key limit for its period, withresets_at).- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 413
invalid_request_error. Code:request_too_large(the body is over 16 MB, or took over 30 seconds to arrive).- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.- 501
api_error. Code:coming_soon: the API, or theengineyou named (withparam: engine), is listed but isn't open yet. Refused straight after the key check, so it is never billed and counts toward no rate limit. Its opening is announced in the Changelog.- 503
overloaded_error. Code:upstream_unavailable. Retry with backoff.
curl https://api.chessdrive.io/v1/engine \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"engine": "stockfish",
"position": {"fen": "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"},
"depth": 30,
"lines": 2
}'Models
GET/v1/models public, no API key
List the Models, their IDs, aliases, limits and the APIs they serve.
Public; no API key needed, so the Site and Docs read it too.
Response
dataarray of objects requireddata[].idstring requireddata[].aliasesarray of strings requiredEmpty for the Embedding model, which has none.
data[].namestring requiredThe public name, e.g. Knight.
data[].apisarray of strings requiredThe APIs that take this Model as
model.data[].context_windowinteger or null requiredTokens, on Generate; over it is 400
context_too_long. Null for the Embedding model.data[].embed_dimensionsinteger or null requiredEach vector's length, on Embed. Null otherwise.
data[].downloadableboolean requireddata[].statusstring requiredcoming_soonfor a Model that is listed but isn't open yet: a call naming it returns 501coming_soon.One ofavailable,coming_soon.
curl https://api.chessdrive.io/v1/modelsUsage
GET/v1/usage
Your requests and what they cost, per UTC day, by API, Model or API key.
The numbers the Dashboard's Usage page shows for the same range and grouping. An Admin's or an Individual's
key sees the whole Account; a Team member's key sees what its creator sees there: the calls of the keys they
created, and their own Playground calls. The Dashboard's Playground calls are a series of their own,
playground, last.
Free: never refused for money (no 402), nothing drawn from the Balance and no row in the Request log, so you
can check why calls fail. A key restricted to other APIs or Models may call it. Its rate limit is its own,
60 requests a minute per Account, shared with GET /v1/balance.
Query parameters
fromstring requiredThe first UTC day,
YYYY-MM-DD.tostring requiredThe last UTC day, included, at most 365 days after
from.group_bystringWhat each series is.
api: one series per API.model: one per Model of Generate and Embed, with""(No Model) for the calls that name none: Search's, Engine's, and those refused before their Model was known.key: one per API key, revoked ones included.One ofapi,model,key.Default"api".
Response
fromstring requiredtostring requiredgroup_bystring requiredapi: one series per API.model: one per Model of Generate and Embed, with""(No Model) for the calls that name none: Search's, Engine's, and those refused before their Model was known.key: one per API key, revoked ones included.One ofapi,model,key.Default"api".daysarray of strings requiredEvery UTC day from
fromtoto, in order.seriesarray of objects requiredOne per API, Model or key with calls in the range, none for those without: APIs in this contract's order, Models in
GET /v1/models's order (then any no longer served, then""), keys oldest first, and the Playground last.series[].idstring requiredThe API (
generate), the Model ID (knight-1, or""), the API key's id, orplaygroundfor the Dashboard's Playground calls.series[].namestring requiredThe Model's or the key's name,
No ModelorPlayground; for an API, its id.series[].requestsarray of integers requiredThe calls each day, failed ones included, in the order of
days.series[].cost_usdarray of strings requiredWhat the calls drew from the Balance each day, in the order of
days. Only successes cost anything.errorsarray of integers requiredThe calls that failed each day, across every series, in the order of
days.totalobject requiredEvery series over the whole range.
total.requestsinteger requiredtotal.cost_usdstring requiredAn amount in dollars, as a decimal string to six places, like
cost_usd.
Errors
- 400
invalid_request_error. Code:invalid_field, withparamnaming the query parameter at fault (from,toorgroup_by).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.
curl "https://api.chessdrive.io/v1/usage?from=2026-10-01&to=2026-10-03&group_by=model" \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY"Balance
GET/v1/balance
Your Account's Plan, Balance, Monthly credit, Trial credits left, this month's spend and Spend limit.
The money the Dashboard's Billing page shows, for an Admin's or an Individual's key. A Team member's key is
refused with 403 key_not_allowed, as Team members see none of an Organization's billing; GET /v1/usage
still shows them their own keys' spend.
Free: never refused for money (no 402), nothing drawn from the Balance and no row in the Request log. A key
restricted to other APIs or Models may call it. Its rate limit is its own, 60 requests a minute per Account,
shared with GET /v1/usage. To top up or change the Spend limit, use the Dashboard.
Response
planstring requiredThe Account's Plan, which sets its rate limits. Every Account starts on
free; a Top-up never changes it. Onfree, Queen takes 100 calls in any 7 days, then answers 403plan_required.One offree,hobby,pro.balance_usdstring requiredWhat is left to spend on calls, Monthly credit and Promo credits included. At 0 or below, calls are refused with 402
insufficient_balance; a call already running may take it a little below 0.monthly_credit_usdstring requiredThe Monthly credit left from the paid Plan's current month, part of
balance_usdand spent before any other dollars.0.000000on Free.monthly_credit_expires_atstring or null requiredWhen the Monthly credit left expires, at the end of the Plan's month. Null when none is left.
trial_credits_usdstring requiredThe Trial credits left, part of
balance_usd. They are spent after Monthly credit and expiring Promo credits, and before Top-ups.trial_credits_expire_atstring or null requiredWhen the Trial credits left expire. Null when none are left, or when they never expire, as Trial credits given today don't.
month_spend_usdstring requiredThe spend this calendar month in UTC, which the Spend limit counts against.
spend_limit_usdstring or null requiredThe Spend limit for each calendar month, in dollars like
cost_usd; oncemonth_spend_usdreaches it, calls are refused with 402spend_limit_reached. Null when the Account has none.
Errors
- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.
curl https://api.chessdrive.io/v1/balance \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY"Study keys
POST/v1/study_keys
Make a Study key, for one Study page to call Engine and Generate.
A Study is a page a person's agent builds for them with the Study Skill. Its Study key lets the
page call POST /v1/engine and POST /v1/generate from the browser when the person asks: the key can call
only those two, with a Key limit of $1 a UTC day, and expires 7 days after it was made. Each is its own key,
listed under Study keys on the Dashboard's API keys page, where it can be revoked.
The page holds the key, so anyone who opens the page can spend it, up to its limit. Engine and Generate answer
a browser from any origin, a page opened as a local file included, with the CORS headers, and so does
GET /v1/models, which a page can read first, free and with no key, to learn whether it can reach the API.
A Study key takes the Model restriction of the key that made it, and is refused when that key can't call
both Engine and Generate. It is never refused for money (no 402), and its own calls are billed to the same
Account. A Study key can't make another, read the Usage API or sign in to the Connector: each answers 403
key_not_allowed. Its rate limit is the Usage API's, 60 requests a minute per Account.
Request body
namestring requiredThe Study's name, as its title says, which the Dashboard lists the key by.
urlstring or nullThe Study's
httpslink, such as a Claude artifact's, which the Dashboard links to. Leave it out for a local file, which the Dashboard can't open.
Errors
- 400
invalid_request_error. Codes:invalid_json,missing_field,invalid_field,unknown_model,invalid_fen,invalid_pgn,invalid_ply,context_too_long(Generate),too_many_inputsandtext_too_long(Embed),unknown_engine,unknown_network,limit_too_highandgame_over(Engine).- 401
authentication_error. Codes:missing_api_key,invalid_api_key,revoked_api_key,expired_api_key,disabled_api_key.- 403
permission_error. Codes:account_suspended,key_not_allowed(the API key is restricted to other APIs, or to another Model on an API that takesmodel; onGET /v1/balance, the key is a Team member's; a Study key anywhere but Engine and Generate), andplan_required(Queen on the Free plan past its 100 calls in any 7 days, counted per Account; Knight still works). Aplan_requiredrefusal carries the rate-limit headers,Retry-After, andresets_at, when the oldest of those calls leaves the 7 days. A Skill falls back to Knight on it; Hobby or Pro lifts it at once.- 429
rate_limit_error: slow down;Retry-Aftersays how long. The code names the limit:rate_limited(requests per minute, Embed items per minute, or requests in flight on Engine and Embed),daily_limit_reached(Free's requests per day),token_rate_limited(tokens per minute, Generate).- 500
api_error. Code:internal_error.
curl https://api.chessdrive.io/v1/study_keys \
-H "Authorization: Bearer $CHESSDRIVE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Your game against Ana",
"url": "https://claude.ai/public/artifacts/0b6c1f0e-2a51-4d37-9a5e-7d3f8a9c2e11"
}'