API reference
Planning
Three routes that cost nothing: count the solves of a request, look at a betting tree, and start a solver ahead of time.
In short
- Three routes, all free: an estimate, a tree preview and a warm-up.
- None of them starts a solve.
The samples continue from the quick start: they use its spot.json and its helper call.
The routes
POST /v1/estimates
The solves and calls a request needs. Free.
The number of solves a request needs, and the calls they cost. It solves nothing. It applies the same request checks as a solve.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
| A spot | body | Yes | The same body as POST /v1/solves for a spot, with then, expand or boards. A parent body is not taken. |
Request
jq '. + {expand: [{lines: "all", cards: "distinct"}]}' spot.json > turns.json
curl -sS -X POST "$GECKO_API/v1/estimates" \
-H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
-d @turns.json
turns = {**spot, "expand": [{"lines": "all", "cards": "distinct"}]}
count = call("POST", "/v1/estimates", json=turns, headers=AUTH)
print(count["solves"], count["credits"], count["exact"])
const turns = { ...spot, expand: [{ lines: "all", cards: "distinct" }] };
const count = await call("POST", "/v1/estimates", { body: turns });
console.log(count.solves, count.credits, count.exact);
Answer
{
"streets": {
"flop": {"solves": 1, "credits": 1},
"turn": {"solves": 180, "credits": 180},
"river": {"solves": 18577, "credits": 18577}
},
"solves": 18758,
"credits": 18758,
"exact": true,
"credits_available": 14547,
"price_at_lowest_pack_rate": 1875.8,
"currency": "usd"
}
The numbers are an upper limit: see Estimates and budgets.
Errorsinvalid_request, no_such_line, request_too_large, and the errors of the key and the account.
POST /v1/trees
The betting tree and exits of a spot. Free.
The betting tree of one street and its exits, without a solve. Use it to find the lines for then and expand.
Parameters
| Name | Where and type | Required | Meaning and limits |
|---|---|---|---|
board, pot, stack | body | Yes | As in a spot. |
| The betting fields | body | No | bet_sizes, raise_sizes, max_raises and the other fields of the betting tree. |
ranges | body | No | Not needed: the tree does not depend on the ranges. |
Request
curl -sS -X POST "$GECKO_API/v1/trees" \
-H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
-d '{"board": ["As", "Ks", "7h"], "pot": 100, "stack": 300, "bet_sizes": [0.33], "raise_sizes": [1.0]}'
preview = call("POST", "/v1/trees", headers=AUTH, json={
"board": ["As", "Ks", "7h"], "pot": 100, "stack": 300, "bet_sizes": [0.33], "raise_sizes": [1.0]})
print(len(preview["nodes"]), [item["line"] for item in preview["exits"]])
const preview = await call("POST", "/v1/trees", {
body: { board: ["As", "Ks", "7h"], pot: 100, stack: 300, bet_sizes: [0.33], raise_sizes: [1.0] },
});
console.log(preview.nodes.length, preview.exits.map((item) => item.line.join(" ")));
Answer
{
"nodes": [
{"node": "n0", "line": [], "kind": "decision", "pot": 100, "player": "oop", "to_call": 0,
"actions": [{"token": "c", "action": "check", "next": "n1"},
{"token": "b33", "action": "bet:33", "next": "n15"},
{"token": "b300", "action": "bet:300", "next": "n24"}]},
{"node": "n2", "line": ["c", "c"], "kind": "exit", "pot": 100, "stack": 300}
],
"exits": [
{"exit_id": "n2", "line": ["c", "c"], "pot": 100, "stack": 300}
],
"note": "Built by the same rules as the solver. Decisions with stated actions (node_actions) are not shown."
}
A node's kind is decision, fold, showdown or exit. More in see the betting tree before you solve.
Errorsinvalid_request, and the errors of the key and the account.
POST /v1/warmup
Start a solver before the first solve. Free.
Start a solver before your first solve. It starts a solver at most one time in 5 minutes for each account. You do not have to wait for it.
Request
curl -sS -X POST "$GECKO_API/v1/warmup" -H "Authorization: Bearer $GECKO_KEY"
print(call("POST", "/v1/warmup", headers=AUTH)["state"])
console.log((await call("POST", "/v1/warmup")).state);
Answer
{"state": "warm"}
{"state": "warming", "ready_in_seconds": 45}
With a test key the answer is always {"state": "warm"}. More in warm-up.
ErrorsThe errors of the key and the account.