Build Low-Latency Poker Analysis with PokerAI Presolved Data and the Live Solver
Read presolved flop strategy from PokerAI and show action frequencies as soon as it returns. Follow a real 200NL 3-bet hand from finding a spot and changing actions and boards to carrying both ranges into live turn and river solves.
/flop/tree and /flop/node. Display action frequencies when the response arrives. When the user selects a new card, project both ranges along the action path and submit a solve for that street. Keep the previous strategy visible while the solver runs.When to use presolved data with the live solver
Start with presolved flop strategy and solve each later street as needed when the Cache directory has no result for the hand or you want to choose the later-street ranges or bet sizes. Free, Starter, Builder and Pro all support this workflow through their own presolved and solve quotas. You still need an available presolved flop spot.
Project both ranges along the actual action path and use those ranges to solve the turn and river separately. The result is a street-by-street approximation of the full three-street tree’s Nash equilibrium. Later strategies depend on the ranges, stacks, available sizes and solve results. Show flop strategy first and fill in each later street as its solve returns.
Quick facts about the 200NL 3-bet hand
This hand uses the 6max_RC_100bb_200NL preflop pack. MP (middle position) opens and SB (small blind) 3-bets. SB holds A♥K♥ on 4♣8♦9♥. The flop starts with 19 BB in the pot and 91 BB effective.
| Street and board | Action | Next step |
|---|---|---|
| Flop4♣ 8♦ 9♥ | SB bets 13 BB MP calls | Deal A♠ |
| TurnA♠ | SB bets 14 BB MP calls | Deal 7♦ |
| River7♦ | SB bets 22 BB MP calls | Showdown |
SB bets 13, 14 and 22 BB across the three streets, and MP calls each time. This is the same hand used in the Cache API guide. The live solver example treats SB as OOP and MP as IP.
Find an available spot
Send the preflop pack, flop and situation to /availability to check whether the presolved library has the hand. This check is free with any valid API key.
curl 'https://pokerai.bet/v1/gto/availability' \
-H "Authorization: Bearer $POKERAI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"type":"flop","request":{"preflop_pack":"6max_RC_100bb_200NL","board":"4c8d9h","pot_type":"3BET","positions":{"raiser":"MP","three_bettor":"SB","hero":"SB"}}}'
Check status: "available", match: "exact" and resolved_preflop_pack before continuing. The existing flop endpoints can fall back to the default pack when the specified one lacks the spot. To reproduce the same hand, verify the resolved pack before letting the user switch data sources.
Read the flop strategy
Call /flop/tree from your backend and keep the API key there. Use the root node token in /flop/node with hole_cards: "AhKh" to read the strategy for A♥K♥.
- 1. Find an available spot
/availabilityCheck presolved coverage for free - 2. Read and show strategy
/flop/treeand/flop/nodeOne tree uses one presolved lookup. Node reads are free. - 3. Project ranges and solve
/flop/projected-range、/turn/projected-rangeand/solverSubmit separate turn and river solves
This request reads the flop root and uses one presolved lookup. See the complete example for the post and waitForTree helpers.
const spot = {
preflop_pack: "6max_RC_100bb_200NL",
board: "4c8d9h",
pot_type: "3BET",
positions: { hero: "SB", raiser: "MP", three_bettor: "SB" },
};
const hand = "AhKh";
const available = await post("/availability", { type: "flop", request: spot });
if (available.status !== "available" || available.match !== "exact" ||
available.resolved_preflop_pack !== spot.preflop_pack) {
throw new Error("This exact presolved Flop spot is not available.");
}
const flop = await post("/flop/tree", { ...spot, hole_cards: hand });
const root = flop.nodes.find((entry) => entry.node === "root" && entry.is_hero);
if (!root?.token) throw new Error("The expected SB root is unavailable.");
const flopStrategy = await post("/flop/node", {
node: root.token,
hole_cards: hand,
});
Render strategy as action frequencies and keep the returned node tokens for follow-up reads. The response field node: "root" can label the path. Pass the corresponding token as node in follow-up requests.
If you already have the strategy matrix for the whole range, select the corresponding row when the hand changes. Fetch strategy again when the action node changes.
Follow the action into the turn and river
SB bets 13 BB on the flop and MP calls. The turn is A♠. SB bets 14 BB, MP calls again and the river is 7♦. Include the final call on each street when projecting the ranges so the result reflects which hands the opponent takes to a call.
| Street and board | Pot entering the street | Effective stack |
|---|---|---|
| Flop4♣ 8♦ 9♥ | 19 BB | 91 BB |
| TurnA♠ | 45 BB | 78 BB |
| River7♦ | 73 BB | 64 BB |
Project both ranges after the flop call
Use /flop/node to confirm the opponent can call after the bet. Then pass the original spot and the action path ending in /CALL to /flop/projected-range. The endpoint reads the effective ranges from the presolved tree and computes the ranges remaining after the action.
const action = flopStrategy.strategy.find((row) => row.action === "bet" &&
!row.allin && row.amount_bb === 13);
const afterBet = flop.nodes.find((entry) => entry.node === "root/BET_13" &&
!entry.is_hero);
if (!action || !afterBet?.token) throw new Error("The 13 BB Flop branch is unavailable.");
const opponent = await post("/flop/node", { node: afterBet.token });
if (!opponent.actions?.some((row) => row.action === "call")) {
throw new Error("The Flop call branch is unavailable.");
}
const turnRanges = await post("/flop/projected-range", {
...spot,
node_id: afterBet.node + "/CALL",
normalize: false,
bluff_discount_ratio: 1,
});
Read the weighted combos from range_oop_new_raw and range_ip_new_raw. Projection uses the previous street’s board. Remove every combo blocked by the new board before submitting the solve and preserve the other combos and weights. This example specifies AhKh for display only and projects and solves with both full ranges. If you call /v1/gto/range and assemble the tree yourself, start from the flop tree’s ranges.effective.
Submit the turn after A♠ is dealt
Send /solver the four-card board 4c8d9hAs, the two ranges after removing combos blocked by A♠, the pot and the effective stack. The public sizing input uses whole percentages of the pot. In this run, 31 produced a 14 BB bet in a 45 BB pot. Continue with the actual returned size.
if (!turnRanges.range_oop_new_raw || !turnRanges.range_ip_new_raw) {
throw new Error("Turn ranges are unavailable.");
}
const turnBoard = ["4c", "8d", "9h", "As"];
const turn = await post("/solver", {
board: turnBoard.join(""),
oop_range: rangeForBoard(turnRanges.range_oop_new_raw, turnBoard),
ip_range: rangeForBoard(turnRanges.range_ip_new_raw, turnBoard),
pot: flop.pot + 2 * action.amount_bb,
effective_stack: flop.effective_stack - action.amount_bb,
hero: "OOP",
bet_sizes: { turn: [31] },
donk_sizes: { turn: [31] },
});
const turnTree = await waitForTree(turn.solve);
const turnRoot = turnTree.nodes.find((entry) => entry.node === "root" && entry.is_hero);
if (!turnRoot?.token) throw new Error("The expected Turn root is unavailable.");
const turnStrategy = await post("/solver/node", {
node: turnRoot.token,
hole_cards: hand,
});
if (!Array.isArray(turnStrategy.strategy)) throw new Error("Turn strategy is unavailable.");
Submit the river after the turn call
Use /turn/projected-range with the turn solve handle and the matching action path. Live trees use paths such as root/BET 14.000000. Append /CALL to the actual returned path. Remove the 7♦ combos from both projected ranges and submit a new river solve on 4c8d9hAs7d.
const selected = await selectBetCall(turnTree, turnStrategy, 14);
const riverRanges = await post("/turn/projected-range", {
solve: turn.solve,
node_id: selected.entry.node + "/CALL",
normalize: false,
bluff_discount_ratio: 1,
});
if (!riverRanges.range_oop_new_raw || !riverRanges.range_ip_new_raw) {
throw new Error("River ranges are not ready.");
}
const riverBoard = [...turnBoard, "7d"];
const river = await post("/solver", {
board: riverBoard.join(""),
oop_range: rangeForBoard(riverRanges.range_oop_new_raw, riverBoard),
ip_range: rangeForBoard(riverRanges.range_ip_new_raw, riverBoard),
pot: Number((turnTree.pot + 2 * selected.bb).toFixed(2)),
effective_stack: Number((turnTree.effective_stack - selected.bb).toFixed(2)),
hero: "OOP",
bet_sizes: { river: [30] },
donk_sizes: { river: [30] },
});
const riverTree = await waitForTree(river.solve);
const riverRoot = riverTree.nodes.find((entry) => entry.node === "root" && entry.is_hero);
if (!riverRoot?.token) throw new Error("The expected River root is unavailable.");
const riverStrategy = await post("/solver/node", {
node: riverRoot.token,
hole_cards: hand,
});
if (!Array.isArray(riverStrategy.strategy)) throw new Error("River strategy is unavailable.");
const showDown = await selectBetCall(riverTree, riverStrategy, 22);
console.log({ turn: selected.bb, river: showDown.bb });
The original river bet was 22 BB. The shown settings returned that branch in the observed run. Display the amount and frequencies the solver returns. After the call takes the hand to showdown, use /solver/release once the final read has finished.
Keep strategy visible while a solve runs
Show strategy and solve status together. After the user selects the turn or river, keep the previous street’s strategy visible while the new street is computing. Poll /solver/tree with the original solve handle until spot_status: "queryable", then request /solver/node with the returned node token.
Let the user decide when to retry after 429 busy. End the wait on no_nodes, error or expired. If submission times out and the result is unknown, preserve the current view to avoid a second paid submission. When the action or board changes, use the request context to discard late responses from the previous selection.
Request timing and quotas
The 0.077479 s flop measurement includes the presolved tree and node reads. The 2.258036 s turn measurement starts at the corrected solve submission. The earlier flop range projection took 0.079021 s separately. The 2.190538 s river measurement starts with turn range projection and includes submission, polling and the node read. Cache bars show individual strategy reads for the same hand.
| Path | Time | Run | |
|---|---|---|---|
| Flop4♣ 8♦ 9♥ | |||
| Cache strategy | 4.425 s | A | |
| Existing endpoints | 0.077 s | D | |
| TurnA♠ | |||
| Cache strategy | 1.348 s | B | |
| Existing endpoints | 2.258 s | E | |
| River7♦ | |||
| Cache strategy | 1.319 s | C | |
| Existing endpoints | 2.191 s | E | |
| API operation | Quota used |
|---|---|
Check the spot with /availability |
0 |
Read one presolved tree with /flop/tree |
1 presolved lookup |
| Read an ordinary flop or solver node with a valid token | 0 |
Project both flop ranges with /flop/projected-range |
1 presolved lookup |
Start a new turn or river computation with /solver |
1 solve per new computation |
Poll /solver/tree, project turn ranges or release a solve |
0 |
The example uses two presolved lookups and up to two solves across the three streets. If a matching solve is returned directly, check the actual solve_quota receipt. Ordinary node reads and polling reuse the original token or handle.
Run the complete example
Keep positions, hole cards, board and action path together. Show the flop strategy as soon as it loads and handle loading and errors separately on the turn and river. Reuse an in-flight submission when the board, ranges, pot, effective stack and sizes all match.
Place the helpers below before the four JavaScript blocks above and run them as a Node.js ES module. Running the example against the production API uses account quota.
const API = "https://pokerai.bet/v1/gto";
const key = process.env.POKERAI_API_KEY;
if (!key) throw new Error("Set POKERAI_API_KEY on your backend.");
async function post(path, body, timeoutMs = 15_000) {
const response = await fetch(API + path, {
method: "POST",
headers: { Authorization: `Bearer ${key}`, "Content-Type": "application/json" },
body: JSON.stringify(body),
signal: AbortSignal.timeout(timeoutMs),
});
const payload = await response.json();
if (!response.ok) throw new Error(`${path}: HTTP ${response.status} (${payload.error ?? payload.status ?? "unknown"})`);
return payload;
}
function rangeForBoard(range, board) {
const blocked = new Set(board);
const combos = range.split(",").map((item) => item.trim()).filter((item) => {
const match = /^([2-9TJQKA][cdhs])([2-9TJQKA][cdhs]):([0-9.]+(?:e[+-]?\d+)?)$/i.exec(item);
if (!match || !Number.isFinite(Number(match[3]))) {
throw new Error("Invalid weighted combo in the projected range.");
}
const canonical = (card) => card[0].toUpperCase() + card[1].toLowerCase();
const first = canonical(match[1]);
const second = canonical(match[2]);
if (first === second) throw new Error("Duplicate card in a projected combo.");
return !blocked.has(first) && !blocked.has(second);
});
if (!combos.length) throw new Error("No legal combinations for the next board.");
return combos.join(",");
}
async function selectBetCall(tree, strategy, targetBb) {
const bets = tree.nodes.flatMap((entry) => {
const match = /^root\/BET (\d+(?:\.\d+)?)$/.exec(entry.node);
return match && !entry.is_hero && entry.token ? [{ entry, bb: Number(match[1]) }] : [];
});
const selected = bets.sort((a, b) => Math.abs(a.bb - targetBb) - Math.abs(b.bb - targetBb))[0];
if (!selected || Math.abs(selected.bb - targetBb) > 0.5 ||
!strategy.strategy.some((row) => row.action === "bet" && !row.allin &&
Math.abs(row.amount_bb - selected.bb) < 0.02)) {
throw new Error(`No supported bet sizing close to ${targetBb} BB.`);
}
const opponent = await post("/solver/node", { node: selected.entry.token });
if (!opponent.actions?.some((row) => row.action === "call")) {
throw new Error("The call branch is unavailable.");
}
return selected;
}
async function waitForTree(solve, deadlineMs = 90_000) {
if (typeof solve !== "string" || !solve) throw new Error("Missing solve handle.");
const deadline = Date.now() + deadlineMs;
while (Date.now() < deadline) {
const tree = await post("/solver/tree", { solve }, Math.min(10_000, deadline - Date.now()));
if (tree.spot_status === "queryable") return tree;
if (!["available", "computing"].includes(tree.spot_status)) {
throw new Error(`Solve stopped: ${tree.spot_status ?? "missing status"}`);
}
const delay = Math.min(1_000, deadline - Date.now());
if (delay > 0) await new Promise((resolve) => setTimeout(resolve, delay));
}
throw new Error("Solve polling timed out. Keep the original handle.");
}
Measurements and reproduction
The hand and action path come from a production Cache API capture on November 18, 2026. Public HTTPS requests to the existing endpoints on November 19 confirmed the same pack, hand and three bets and calls at 13, 14 and 22 BB. Both solves started new computations. The run used two presolved lookups and two solves.
The first turn submission returned invalid_range and used no solve quota. The previous street’s ranges still contained A♠. After filtering the conflicting combos as shown, the original path solved successfully. The chart identifies the collection rounds. The public boards and actions stayed the same when the ranges were projected and filtered.
When citing the measurements, include the strategy pack, board, action path, date and timing method. This guide is for training, research and post-session review. Real-time analysis here means exploring spots interactively in a tool. Real-time assistance at real-money tables is prohibited.
API docs · API reference · Live solver workflow · OpenAPI · llms.txt
Read all three streets directly when a full cache is available
With Builder or Pro and a fully cached spot, you can read strategy from the same presolved tree as actions and boards change. The companion guide follows the same 200NL 3-bet hand from free coverage discovery to three-street strategy and on-demand EV and equity. Build Low-Latency, Real-Time Poker Analysis with the PokerAI Cache API