Solving

The spot

A spot is the body of POST /v1/solves: one street of one hand. Four fields are required. All the others have a default.

In short

  • Four fields are required: board, pot, stack and ranges. All the others have a default.
  • Chips are whole numbers. Ten chips for one big blind is a common choice.
  • The default betting tree has bets of 33% and 75% of the pot, one raise of the pot, and the all-in.
  • Every field is checked before anything runs or is charged. A field name the API does not know is refused.

The quick start has a complete spot to copy.

Board and money

boardlist of 3 to 5 cards, required
Distinct cards. A card is a rank (2 to 9, T, J, Q, K, A, upper case) and a suit (c, d, h, s, lower case): "As", "Td", "7h". Three cards make a flop solve, four a turn solve, five a river solve.
boardslist of boards
In place of board: many boards in one request.
potwhole number, required
Chips in the pot at the start of the street. 1 to 1,000,000.
stackwhole number, required
Chips each player has behind at the start of the street. Both players have the same; when they differ, send the smaller stack. 1 to 10,000,000.
rangeslist of two ranges, required
The out-of-position player first, then the in-position player. See ranges.

Chips are whole numbers in any unit you choose. Ten chips for one big blind gives sizes to a tenth of a big blind. Bets are rounded up to one chip.

Ranges

A range is one of two forms.

  • A map from hands and hand classes to weights from 0 to 1: {"AhKh": 1, "AKs": 0.5, "AKo": 0.25, "QQ": 1}. A hand is two cards. A class is a pair (QQ), a suited class (AKs) or an offsuit class (AKo). What you do not name has weight 0. A later name in the map replaces an earlier one for the same hand.
  • A list of 1,326 weights, one for each hand, in the order of GET /v1/hands. Positions start at 0.

There is no shorthand: "QQ+", "A2s-A5s" and "AK" are refused. Name each class. Each range needs at least one hand with a weight above 0.

The order of the 1,326 hands: GET /v1/hands

GET /v1/hands returns {"order": "pio-rank-cdhs-high-low-v1", "hands": [...]}: the 1,326 hand names from "2d2c" to "AsAh". Results name hands the same way: the higher card first, and for a pair the higher suit first in the order c, d, h, s.

curl -sS "$GECKO_API/v1/hands" | jq '{order, count: (.hands | length), first: .hands[0], last: .hands[-1]}'

The betting tree

Sizes are shares of the pot: 0.33 is a bet of 33% of the pot. A raise size is a share of the pot after the call. Every field is optional.

bet_sizesdefault [0.33, 0.75]
Bet sizes, at most 3, each above 0 and at most 5, no size two times. With an empty list the only bet is the all-in, when all_in is on.
raise_sizesdefault [1.0]
Raise sizes, at most 2, each above 0 and at most 5, no size two times.
max_raisesdefault 1
Raises over a bet on this street: 0, 1 or 2. More raises make a solve slower and a result larger.
all_indefault true
Adds the all-in to the bets and raises.
More tree rules: thresholds, the smallest bet, the in-position player's own sizes
force_all_in_thresholddefault 100
Percent, 1 to 100. A bet or raise that puts in more than this share of what the player can put in becomes the all-in.
add_all_in_thresholddefault null
Percent, 1 to 2,000. With a value, the all-in is added only where it is smaller than this share of the pot. null adds it everywhere.
merge_thresholddefault 0
Percent, 0 to 100. Sizes closer together than this are merged: the larger one stays.
min_betdefault 1
The smallest bet, in chips. 1 to 1,000,000. With rake it must be 10.
ip_bet_sizes, ip_raise_sizes, ip_all_indefault null
The in-position player's own sizes, with the same limits. A field that is null uses the same setting as the out-of-position player.
Decisions set one by one: node_actions
node_actionslist, at most 16
The actions of single decisions, stated one by one in place of the sizes: {"path": ["c"], "fold": true, "call": true, "targets": [40, 110]}. path is the line to the decision, in the tokens c, f and b with chips. targets are bets or raises as chips in on the street, smallest first, at most 5. First street of a request only.

Look it up

Solve settings

iterations, accuracy, metadata
iterations500 or 2000, default 500
How long the solver works on the street. The price is the same: one call. Another number is refused.
accuracy"fast" or "accurate", default "fast"
"accurate" is for turn solves: the solver looks at every river card. The price is the same: one call. It needs a turn, no rake and no ICM, and a stack of at most 4 pots. Anything else is refused: with 422 where the request names the street, and as a failed solve inside a then or expand request.
metadataobject, optional
Your own notes, at most 4,000 characters as compact JSON: no spaces after : and ,. Returned on the root solve. Do not put personal data in it: no names and no player identifiers.

GET /v1/health shows under solver what the solver takes now: rake_range, tree_options, node_locks, iterations, accuracy and icm.

Rake and ICM

the utility field

utility says what the players win. The default is chips: {"kind": "chip"}. Send it for a raked cash game or for a tournament spot with ICM.

Rake: {"kind": "rake"}

{"kind": "rake", "rate": 0.05, "cap": 40}: chips with rake. rate is above 0 and at most 0.1.

cap is in chips, above 0 and at most 100. With rake, ten chips are one big blind, and min_bet must be 10.

The result's profile.rake_quality is "full" for 5% with a cap of 30 or 40 chips and "approximate" for other rake.

ICM: {"kind": "icm"}

For ICM you send the value of each player's possible tournament stacks from your own ICM calculation: remaining (the two stacks behind, out of position first), pot (the same as the request's), knots (for each player 2 to 4,096 points of [stack, value], the stacks rising and the values not falling, that cover every stack the hand can end with), payouts (falling) and players_remaining. The request's stack is the smaller of the two stacks.

Satellites are not supported. ICM does not run with a test key.

Locks

fix the strategy of some hands

A lock fixes the strategy of some hands at one decision. The solver then solves the rest of the street around it. Locks are for the first street of a request only.

The fields of a lock
lockslist, at most 32
Decisions where some hands play a strategy you state: {"path": ["c"], "actions": ["c", "b33", "b300"], "hands": [1325], "strategy": [[0.5, 0.5, 0]]}. path is the line to the decision. actions are the actions of that decision as a result names them, in the order of your probabilities. hands are positions in the 1,326 hands, from 0, and strategy has one row for each of them; a row adds up to 1. One lock for each decision. Hands you do not list stay free. At most 16,000 hands in one solve. First street of a request only.

The other fields of a request

parent, then, expand, the budget
parent, line, exit_id, card
In place of the situation: the next street of a solve.
then
One line: at most two steps of {"line", "card"}.
expand
Many lines and cards: at most two levels of {"lines", "cards"}.
max_credits, allow_partial
The budget of the request.

Request checks

what is refused, and when

The body is one JSON object, at most 2 MiB. Every field is checked before anything runs or is charged. The checks are the same for a live key, a test key, an estimate and a tree preview.

  • A field name we do not know is refused, also inside a then step, an expand level and utility: 422 invalid_request, “Unknown field in the request: bet_size (did you mean bet_sizes?)”. A misspelled field never gives a solve with the default in its place.
  • A value outside its limits is refused with 422 invalid_request. detail names the field and the limit.
  • The solver itself checks locks, node_actions and ICM. When it refuses a first street, the answer is 422 invalid_request with a solve_id; the solve is kept as failed and is not charged. A test key does not check locks and node_actions.
  • Send JSON as JSON. Every POST with a body needs the header Content-Type: application/json. Without it the answer is 422 invalid_request, “Send the body as JSON with the header Content-Type: application/json.”
  • A refused request is never charged.