Solving

Estimates and budgets

Count the solves and the calls of a request before you send it, give a request a budget, and look at a betting tree without a solve. All three are free.

In short

  • POST /v1/estimates counts the solves and the calls of a request. It is free and solves nothing.
  • max_credits is the most calls a request may use. A request above it is refused before anything runs.
  • POST /v1/trees shows the betting tree and the exits of a spot, without a solve.

Ask for an estimate

POST /v1/estimates takes the same body as POST /v1/solves for a spot and answers with the number of solves it needs and the calls they cost (credits). It solves nothing and costs nothing. It runs the checks of a solve: the field names, the limits, the size of the request, metadata, and ICM with a test key.

jq '. + {expand: [{lines: "all", cards: "distinct"}, {lines: "all", cards: "distinct"}]}' spot.json > big.json

curl -sS -X POST "$GECKO_API/v1/estimates" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
  -d @big.json
The 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"
}
How to read the numbers
  • The numbers are an upper limit. exact is true when the count follows from the betting tree alone, and false with node_actions or ICM. A real solve leaves out lines that no hand reaches, so a request can need fewer solves than the estimate, never more.
  • credits_available is the calls you have left. price_at_lowest_pack_rate is the price of that many calls bought with pay per call, without a plan.
  • With boards the answer adds "boards", the number of boards, and counts all of them.
  • An estimate takes a spot, with board or boards. It does not take a parent body: the answer is 422 invalid_request.
  • An estimate gives no time. See throughput.

Budgets: max_credits and allow_partial

The server makes the same estimate when you send a request, and checks it against two limits before anything runs.

max_creditswhole number, optional
The most calls this request may use. Without it, and above it, the account's limit for one request applies: 20,000 calls unless we changed it for you. A request whose estimate is above the budget is refused: 422 max_credits_exceeded, with the estimate in the answer.
allow_partialboolean, optional
true or false; another value is refused. true starts the request even when the estimate is above the budget or above your balance. It runs until the budget or your calls end. Then tree.status is "stopped", the solves that did not start are skipped, and what is finished stays readable.

With a live key, a request whose estimate is above your balance is refused: 402 insufficient_credits, with the estimate and your balance (credits) in the answer. Nothing is charged for a refused request.

The refusal: 422 max_credits_exceeded
{
  "type": "https://api.gtogecko.com/docs/errors#error-max_credits_exceeded",
  "title": "Max credits exceeded",
  "status": 422,
  "code": "max_credits_exceeded",
  "detail": "This request needs about 181 credits, above the limit of 100. Raise max_credits, name fewer lines or cards, or send allow_partial.",
  "request_id": "req_c0dfe7b07251e03318f9",
  "estimate": {"streets": {"flop": {"solves": 1, "credits": 1}, "turn": {"solves": 180, "credits": 180}}, "solves": 181, "credits": 181, "exact": true},
  "max_credits": 100
}

See the betting tree before you solve

POST /v1/trees takes board, pot, stack and the betting fields, and answers with the betting tree of the street and its exits. No ranges, no solve, no charge.

Use it to find the lines for then and expand. It applies the same request checks as a solve.

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]}' \
  | jq '{nodes: (.nodes | length), exits}'
The answer (part)
{
  "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."
}
What the preview does not show

A node's kind is decision, fold, showdown or exit. The preview shows the whole tree of your sizes.

It does not show decisions changed with node_actions, and a real solve leaves out the lines that no hand reaches. What a request runs always follows the exits of the solved street.