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/solves starts a solve and answers 202. 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.

Key needed1 call for each solveFree with a test key

Parameters

NameWhere and typeRequiredMeaning and limits
PreferheaderNowait=N holds the answer up to N seconds while the solve is not finished. The most is 30. See Waiting for a result.
Idempotency-KeyheaderNo8 to 128 characters. A repeat with the same body gets the first answer again for 24 hours. See safe to repeat.
board, pot, stack, rangesbodyYes, for a spotThe spot. With the betting and solve settings, every field is in The spot.
boardsbody · list of boardsNoIn place of board: the same spot on each board, at most 2,000. See many boards.
parent, line, exit_id, cardbodyYes, for a next streetIn 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.
thenbody · listNoAt most 2 steps of {"line", "card"}: one line to the river.
expandbody · listNoAt most 2 levels of {"lines", "cards"}: many lines and cards. Not together with then.
max_creditsbody · whole numberNoThe most calls this request may use. See budgets.
allow_partialbody · booleanNotrue 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.
metadatabody · objectNoYour 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

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe id of a solve of your account. It starts with slv_.
PreferheaderNowait=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"

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe 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

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe 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' 

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe id of a solve of your account. It starts with slv_.
node_idpath · stringYesA node id of the result, such as r:0:c:b33. Take it from the list of nodes.
handsquery · list with commasNoOnly 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"

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe 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"

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe id of a solve of your account. It starts with slv_.
scopequery · stringNochildren (default): the solves one street below this solve. tree: every solve of the request this solve belongs to, without the root.
statusquery · stringNoOnly solves in this state, for example complete. A value that is not a state gives an empty list.
limitquery · whole numberNo1 to 500. Default 100.
afterquery · stringNoThe 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}' 

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
idpath · stringYesThe 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}' 

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.

Key neededFree

Parameters

NameWhere and typeRequiredMeaning and limits
limitquery · whole numberNo1 to 200. Default 50.
afterquery · stringNoThe 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}' 

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.
statusstring
pending, queued, running, complete, failed, skipped or cancelled.
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. null on a first street. To get the whole path of a river solve, follow parent.
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_charged on its root, and the ledger.
livemodeboolean
true for a live key, false for 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}/exits or 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, expand or boards: the progress of the whole request. See the tree block.
metadataobject
What you sent as metadata. On the root only.