API reference
Solves
Nine routes: start a solve, read its state and its result, go through a request with many solves, and stop it.
In short
- Nine routes. Open a route to see its parameters, a sample in three languages, a sample answer and its errors.
POST /v1/solvesstarts a solve and answers202. Every other route here is free.
The samples continue from the quick start: spot.json is its spot, and $FLOP, flop is the flop solved there. They use its helpers call and wait_for.
The routes
POST /v1/solves
Solve a spot, the next street of a solve, or many boards.
Start a solve: a spot, the next street of a finished solve, or the same spot on many boards. The answer is 202 with a solve. Read its status to see whether it is finished.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
Prefer | header | No | wait=N holds the answer up to N seconds while the solve is not finished. The most is 30. See Waiting for a result. |
Idempotency-Key | header | No | 8 to 128 characters. A repeat with the same body gets the first answer again for 24 hours. See safe to repeat. |
board, pot, stack, ranges | body | Yes, for a spot | The spot. With the betting and solve settings, every field is in The spot. |
boards | body · list of boards | No | In place of board: the same spot on each board, at most 2,000. See many boards. |
parent, line, exit_id, card | body | Yes, for a next street | In place of a spot: a complete solve, the line that ended its street (line or exit_id; with both, exit_id is used) and the next card. board, pot, stack and ranges in such a body are ignored. See step by step. |
then | body · list | No | At most 2 steps of {"line", "card"}: one line to the river. |
expand | body · list | No | At most 2 levels of {"lines", "cards"}: many lines and cards. Not together with then. |
max_credits | body · whole number | No | The most calls this request may use. See budgets. |
allow_partial | body · boolean | No | true starts a request that is above its budget or your balance, and runs it until one of them ends. Another value than true or false is refused. |
metadata | body · object | No | Your own notes, at most 4,000 characters as compact JSON. No personal data. |
Request
curl -sS -X POST "$GECKO_API/v1/solves" \ -H "Authorization: Bearer $GECKO_KEY" \ -H "Content-Type: application/json" \ -H "Prefer: wait=30" \ -d @spot.json
created = call("POST", "/v1/solves", json=spot, headers=WAIT)
print(created["id"], created["status"])
const created = await call("POST", "/v1/solves", { headers: wait, body: spot });
console.log(created.id, created.status);
Answer
{
"id": "slv_00VcT0iMuhDqPySfwtq2K",
"object": "solve",
"status": "complete",
"street": "flop",
"board": ["As", "Ks", "7h"],
"pot": 100,
"stack": 300,
"parent": null,
"root": "slv_00VcT0iMuhDqPySfwtq2K",
"line": null,
"exit_id": null,
"card": null,
"credits": 1,
"livemode": false,
"created": 1796049035.02,
"started": 1796049035.03,
"finished": 1796049035.04,
"expires_at": 1796567435.04,
"error": null,
"result": "/v1/solves/slv_00VcT0iMuhDqPySfwtq2K/result"
}
Every field of a solve is in the solve object below.
Errorsinvalid_request, request_too_large, no_such_line, max_credits_exceeded, insufficient_credits, credit_limit, expand_not_allowed, idempotency_conflict, request_in_progress, parent_not_complete, parent_expired, not_started, and the errors of the key and the account.
GET /v1/solves/{id}
State, queue and progress of a solve.
The state of one solve. For the root of a request with many solves, also the progress of the whole request in tree.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
Prefer | header | No | wait=N holds the answer up to N seconds while the solve, or the request under a root, is not finished. The most is 30. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP" \ -H "Authorization: Bearer $GECKO_KEY" -H "Prefer: wait=30"
solve = call("GET", f"/v1/solves/{flop['id']}", headers=WAIT)
print(solve["status"], solve.get("queue"), solve.get("tree"))
const solve = await call("GET", `/v1/solves/${flop.id}`, { headers: wait });
console.log(solve.status, solve.queue, solve.tree);
Answer
{
"id": "slv_00VcT0iMuhDqPySfwtq2K",
"status": "pending",
"queue": {"position": 3, "estimated_start_seconds": 8, "solver": "warm"}
}
queue is there while a live solve waits or runs: see the queue. tree is on the root of a request with many solves: see the tree block.
Errorsnot_found, and the errors of the key and the account.
GET /v1/solves/{id}/result
The result of one street.
The solution of one street as one JSON document: every decision, with the strategy, the EV and the weight of each hand, and the exits. It can be large: ask for gzip.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP/result" \ -H "Authorization: Bearer $GECKO_KEY" --compressed -o result.json
whole = call("GET", f"/v1/solves/{flop['id']}/result", headers=AUTH)
print(whole["schema"], whole["tree"]["strategy"]["actions"])
const whole = await call("GET", `/v1/solves/${flop.id}/result`);
console.log(whole.schema, whole.tree.strategy.actions);
Answer
{
"schema": "cloud-result-v1",
"model_id": "2bf1217b...",
"hand_order": "pio-rank-cdhs-high-low-v1",
"input": { ... },
"tree": {
"node_id": "r:0", "node_type": "OOP_DEC", "pot": 100,
"strategy": {"actions": ["b300", "b33", "c"], "strategy": {"AhKh": [0.0001, 0.7832, 0.2167]}, "evs": { ... }, "range": { ... }},
"childrens": {"c": { ... }, "b33": { ... }, "b300": { ... }}
},
"exits": {"n2": { ... }, "n5": { ... }}
}
Results explains every field. A complete real result: sample-result.json.
Errorsnot_found, not_ready, not_a_solve, expired, result_unavailable, and the errors of the key and the account.
GET /v1/solves/{id}/nodes
The nodes of a result.
Every node of a result, without the data of each hand: the node id, its type, the pot and, at a decision, the actions. The type is OOP_DEC or IP_DEC (the out-of-position or the in-position player decides), SPLIT_NODE (the street ends and a card comes: an exit) or END_NODE (the hand ends). More in the result format.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP/nodes" -H "Authorization: Bearer $GECKO_KEY" | jq '.data | length'
nodes = call("GET", f"/v1/solves/{flop['id']}/nodes", headers=AUTH)["data"]
print(len(nodes), nodes[0]["node_id"], nodes[0]["actions"])
const nodes = (await call("GET", `/v1/solves/${flop.id}/nodes`)).data;
console.log(nodes.length, nodes[0].node_id, nodes[0].actions);
Answer
{
"data": [
{"node_id": "r:0", "type": "OOP_DEC", "pot": 100, "actions": ["b300", "b33", "c"]},
{"node_id": "r:0:c", "type": "IP_DEC", "pot": 100, "actions": ["b300", "b33", "c"]},
{"node_id": "r:0:c:c", "type": "SPLIT_NODE", "pot": 100},
{"node_id": "r:0:b300:c", "type": "END_NODE", "pot": 700}
]
}
Errorsnot_found, not_ready, not_a_solve, expired, result_unavailable, and the errors of the key and the account.
GET /v1/solves/{id}/nodes/{node_id}
One decision: range, strategy and EV of each hand.
One node of a result. At a decision: every hand with its weight, its strategy and its EVs, and the node after each action.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
node_id | path · string | Yes | A node id of the result, such as r:0:c:b33. Take it from the list of nodes. |
hands | query · list with commas | No | Only these hands and hand classes: AhKh,QhQd, AKs, AKo, AA. A hand can have its two cards in either order: KhAh is AhKh. A hand that is not at the node is left out. A name that is not a hand or a hand class is 422 invalid_request. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP/nodes/r:0:c:b33?hands=AhKh,QhQd" \ -H "Authorization: Bearer $GECKO_KEY"
one = call("GET", f"/v1/solves/{flop['id']}/nodes/r:0:c:b33", headers=AUTH, params={"hands": "AhKh,QhQd"})
print(one["actions"], one.get("hands", {}).get("AhKh"))
const one = await call("GET", `/v1/solves/${flop.id}/nodes/r:0:c:b33?hands=AhKh,QhQd`);
console.log(one.actions, one.hands?.AhKh);
Answer
{
"node_id": "r:0:c:b33",
"type": "OOP_DEC",
"pot": 133,
"actions": ["b300", "b199", "c", "f"],
"children": {"b300": "r:0:c:b33:b300", "b199": "r:0:c:b33:b199", "c": "r:0:c:b33:c", "f": "r:0:c:b33:f"},
"hands": {
"AhKh": {"range": 0.2167, "strategy": [0.0014, 0.0100, 0.9886, 0.0000], "evs": [143.04, 153.90, 158.27, 0.0]},
"QhQd": {"range": 0.6631, "strategy": [0.0000, 0.0000, 0.9999, 0.0001], "evs": [-13.69, -1.18, 7.97, 0.0]}
}
}
Errorsnot_found, no_such_node, invalid_request, not_ready, not_a_solve, expired, result_unavailable, and the errors of the key and the account.
GET /v1/solves/{id}/exits
The lines that end the street.
The lines that end the street of a finished flop or turn solve with chips behind, in the order of the betting tree. A river solve has none.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP/exits" -H "Authorization: Bearer $GECKO_KEY"
exits = call("GET", f"/v1/solves/{flop['id']}/exits", headers=AUTH)["data"]
print([(item["exit_id"], item["line"]) for item in exits])
const exits = (await call("GET", `/v1/solves/${flop.id}/exits`)).data;
console.log(exits.map((item) => [item.exit_id, item.line.join(" ")]));
Answer
{
"data": [
{"exit_id": "n2", "line": ["c", "c"], "pot": 100, "stack": 300},
{"exit_id": "n5", "line": ["c", "b33", "c"], "pot": 166, "stack": 267},
{"exit_id": "n8", "line": ["c", "b33", "b199", "c"], "pot": 498, "stack": 101},
{"exit_id": "n17", "line": ["b33", "c"], "pot": 166, "stack": 267},
{"exit_id": "n20", "line": ["b33", "b199", "c"], "pot": 498, "stack": 101}
]
}
Errorsnot_found, not_ready, not_a_solve, expired, result_unavailable, and the errors of the key and the account.
GET /v1/solves/{id}/children
The solves under a solve, or the boards of a batch.
The next-street solves under a solve, in pages. With scope=tree: every solve of the request, on all streets. Read the solves of a request has a helper that reads every page.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
scope | query · string | No | children (default): the solves one street below this solve. tree: every solve of the request this solve belongs to, without the root. |
status | query · string | No | Only solves in this state, for example complete. A value that is not a state gives an empty list. |
limit | query · whole number | No | 1 to 500. Default 100. |
after | query · string | No | The next value of the page before. Stop when next is null. |
Request
curl -sS "$GECKO_API/v1/solves/$FLOP/children?status=complete&limit=100" \
-H "Authorization: Bearer $GECKO_KEY" | jq '.data[] | {id, street, card, status}'
page = call("GET", f"/v1/solves/{flop['id']}/children", headers=AUTH, params={"status": "complete", "limit": 100})
print([(child["street"], child["card"]) for child in page["data"]], page["next"])
const page = await call("GET", `/v1/solves/${flop.id}/children?status=complete&limit=100`);
console.log(page.data.map((child) => [child.street, child.card]), page.next);
Answer
{
"data": [
{"id": "slv_00VcTmQVLogJm46Hi0tFQ", "object": "solve", "status": "complete", "street": "turn",
"board": ["As", "Ks", "7h", "2c"], "pot": 166, "stack": 267,
"parent": "slv_00VcTmQIsNPXaohyCScoT", "root": "slv_00VcTmQVLogJm46Hi0tFQ",
"line": ["c", "b33", "c"], "exit_id": "n5", "card": "2c", "credits": 1, "livemode": false,
"created": 1796060406.09, "started": 1796060406.46, "finished": 1796060406.61, "expires_at": 1796578806.61,
"error": null, "result": "/v1/solves/slv_00VcTmQVLogJm46Hi0tFQ/result"}
],
"next": null
}
Errorsnot_found, invalid_request, and the errors of the key and the account.
POST /v1/solves/{id}/cancel
Stop a request.
Stop a request. Solves that wait are cancelled and not charged. A solve that runs finishes and is charged.
What is finished stays readable. The id of any solve of the request stops the whole request.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
id | path · string | Yes | The id of a solve of your account. It starts with slv_. |
Request
curl -sS -X POST "$GECKO_API/v1/solves/$FLOP/cancel" -H "Authorization: Bearer $GECKO_KEY" | jq '{id, status}'
ended = call("POST", f"/v1/solves/{flop['id']}/cancel", headers=AUTH)
print(ended["id"], ended["status"])
const ended = await call("POST", `/v1/solves/${flop.id}/cancel`);
console.log(ended.id, ended.status);
Answer
{
"id": "slv_00VcTmQnhVW4BQ6yEo75y",
"status": "complete",
"tree": {
"status": "cancelled", "stop_reason": "cancelled", "estimated_credits": 181, "credits_charged": 4, "max_credits": 400,
"solves": {"pending": 0, "queued": 0, "running": 0, "complete": 4, "failed": 0, "skipped": 0, "cancelled": 177}
}
}
The answer is the root of the request with its tree, whichever solve of the request you named. After a stop, the solves that will not run are counted as skipped or cancelled at once. A request that was already finished is returned as it is; a single solve has no tree.
Errorsnot_found, and the errors of the key and the account.
GET /v1/solves
Your requests, newest first.
Your requests, newest first: one row for each root. The solves under a root are at its /children.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
limit | query · whole number | No | 1 to 200. Default 50. |
after | query · string | No | The next value of the page before. Stop when next is null. |
Request
curl -sS "$GECKO_API/v1/solves?limit=2" -H "Authorization: Bearer $GECKO_KEY" \
| jq '{ids: [.data[].id], next}'
listing = call("GET", "/v1/solves", headers=AUTH, params={"limit": 2})
print([row["id"] for row in listing["data"]], listing["next"])
const listing = await call("GET", "/v1/solves?limit=2");
console.log(listing.data.map((row) => row.id), listing.next);
Answer
{
"data": [
{"id": "slv_00VcTmQnhVW4BQ6yEo75y", "object": "solve", "status": "complete", "street": "flop", "tree": { ... }, ...},
{"id": "slv_00VcTmQVLogJm46Hi0tFQ", "object": "solve", "status": "complete", "street": "turn", ...}
],
"next": "0:1796060406095:000000"
}
Errorsinvalid_request, and the errors of the key and the account.
The solve object
Every field of a solve.
Every solve route answers with a solve. Read status first: see Life of a solve.
idstring- The solve, for all later calls. Starts with
slv_. objectstring"solve", or"batch"for the root of a request with many boards.statusstringpending,queued,running,complete,failed,skippedorcancelled.street,board,pot,stack- What this solve solves. For a later street the pot and stack come from the exit.
parent,line,exit_id,card- For a later street: the solve it continues, the line and exit taken on that solve's street, and the card dealt.
nullon a first street. To get the whole path of a river solve, followparent. rootstring- The first solve of the request this solve belongs to.
creditsnumber- The price of this solve in calls: 1. One call is one credit. It is the price, not the charge: a solve that was skipped or cancelled shows it too, and was not charged. What a request was charged is
tree.credits_chargedon its root, and the ledger. livemodebooleantruefor a live key,falsefor a test key.created,started,finished,expires_at- Times in seconds since 1970 (UTC). The result can be read until
expires_at: 6 days after the solve finished. errorobject or null{"code", "message"}on a failed, skipped or cancelled solve. See errors on a solve.resultstring or null- The path of the result, once the solve is complete.
exitslist- The exits, in tree order. Present after the first call of
GET /v1/solves/{id}/exitsor after the solve was continued. Call the exits route when you need them. queueobject- While a live solve waits or runs: its place in line and the expected start. See the queue.
stands_forlist- On a solve made by
"cards": "distinct": the other cards this solve is also the answer for. See distinct cards. treeobject- On the root of a request with
then,expandorboards: the progress of the whole request. See the tree block. metadataobject- What you sent as
metadata. On the root only.