iOS app
SwiftUI interface with PokerKit game mechanics and decision capture.
Case study
A native 6-max, 100BB training table where five GTO opponents play every hand through the same Pokerai API available to developers. Counterplay records every Hero decision, grades it against returned frequencies, groups recurring deviations into leak reports, and keeps the underlying hands ready for review or optional grounded coaching.


01 / architecture
Counterplay separates game mechanics, session state, and strategic truth. PokerKit advances the six-handed table; the trainer service preserves the ordered action line, effective stacks, ranges, and review context; Pokerai API supplies presolved lookups or real-time solver output. The same response can drive opponent play, Hero grading, range visualization, and later coaching without embedding private charts in the app.
SwiftUI interface with PokerKit game mechanics and decision capture.
FastAPI holds the current hand, action line, ranges, and review context.
Presolved preflop and flop strategy plus queued turn and river solving.
02 / product loop
The product does more than expose one solver response. It turns individual decisions into an analysis report, then keeps the underlying hands available for review and follow-up study.
Group similar decisions, show sample counts and average deviation, then rank repeated preflop and postflop patterns by severity.

Search by hand, position, or cards; inspect the result and net BB; then reopen the exact decision sequence behind a report.

Choose quick presolved lookup or an exact live solve, define the pot and positions, and carry the result into a focused discussion.

Keep the training surface focused while letting the player choose locale, table identity, and the optional model used for explanations.

03 / endpoint ledger
Traced from the real client (method → endpoint → where it's used):
/v1/gto/preflopVillain preflop actions + grading Hero's preflop decision
/v1/gto/preflop/rangeThe 13×13 range grid shown in review
/v1/gto/flop/treePostflop decision tree for the flop spot
/v1/gto/flop/nodeStrategy at the current flop node (+ grading)
/v1/gto/flop/projected-rangeUpdate ranges along the flop action line
/v1/gto/rangeAssemble solver_results for an action line
/v1/gto/turn/projected-rangeFlop → turn range handoff
/v1/gto/solverSubmit a turn/river spot for real-time solving
/v1/gto/solver/treeDecision tree of the solved turn/river spot
/v1/gto/solver/nodeStrategy at a turn/river node (+ grading)
04 / implementation proof
The client does not embed charts or solver output. It shapes the current spot, sends an authenticated request, and returns normalized strategy frequencies to the trainer.
class GtoClient:
def __init__(self, settings):
self._headers = {"Authorization": f"Bearer {settings.gto_api_key}"}
async def preflop(self, hole_cards, hero_pos, preflop_actions):
body = {"hole_cards": hole_cards,
"positions": {"hero": hero_pos},
"preflop_actions": preflop_actions}
return _strategy_from(await self._post("/v1/gto/preflop", body))
async def flop_node(self, node_token, hole_cards=None):
body = {"node": node_token}
if hole_cards: body["hole_cards"] = hole_cards
return _strategy_from(await self._post("/v1/gto/flop/node", body))
# … + solver_schedule / solver_tree / solver_node, all one-liners over _post()05 / decision loop
Send cards, position, and ordered actions; use returned frequencies for play and grading.
Load the presolved tree, resolve the active node, and project ranges after each action.
Hand ranges to the real-time solver, poll the job, then read the resulting strategy node.
Measure the chosen action by its own GTO frequency and pass structured context to the optional coach.
Counterplay is a Pokerai API product integration maintained by Pokerai API. It is not presented as a third-party customer deployment. This technical record documents the iOS trainer workflow and the public API endpoints used by that workflow. The current product targets six-handed 100BB cash-game training, randomizes Hero's seat, uses five strategy-driven opponents, and reduces multiway postflop spots to a heads-up approximation. Coaching is optional. Counterplay does not enable real-time assistance at real-money tables. This page makes no claim about customer adoption, downloads, benchmark performance, commercial partnerships, or external endorsements.
Build on the same API
Start with a free key, make one preflop call, then follow the same public endpoints used here.