Get started

Quick start

Five steps take you from a key to a solved flop and its turn.

In short

  • You need a test key, and curl, Python or Node. A test key is free.
  • Each step has one sample. Choose one language and stay with it: the samples build on each other.

Before you start: what each language needs

Choose one language and follow its samples through all five steps: the samples of one language build on each other. Work in one new folder and one terminal window. Every language needs the two export lines of step 1 in that terminal, and the file spot.json of step 2 in that folder.

curl
You need curl and jq. Check with jq --version. To install jq: brew install jq on macOS, sudo apt install jq on Ubuntu. Paste each sample into the terminal, step after step. On Windows use WSL or Git Bash, or follow the Python or JavaScript samples.
Python
You need Python 3 and the requests package: the three lines below install it into the folder. Put the samples of all steps in one file, quickstart.py, in order, and run python3 quickstart.py.
JavaScript
You need Node 18 or later. Check with node --version. There is nothing to install. Put the samples of all steps in one file, quickstart.mjs, in order, and run node quickstart.mjs.
python3 -m venv .venv
source .venv/bin/activate
pip install requests
  • In PowerShell, write $env:GECKO_API = "https://api.gtogecko.com" and $env:GECKO_KEY = "gecko_test_..." in place of the two export lines.
  • The terminal of macOS runs zsh. It prints command not found: # for a comment line in a shell sample. That is harmless, and setopt interactivecomments stops it.
  • The Python that comes with macOS prints a NotOpenSSLWarning line. That is harmless too.
  1. 1Get a key
  2. 2Describe the spot
  3. 3Solve
  4. 4Read the answer
  5. 5Go on to the turn

Step 1 of 5

Get a key

  1. Open the console and sign in with Google, or with the email address and password of your GTO Gecko account.
  2. Fill in “Create your API account”: your name, your company and your country, and accept the Terms. The API is for businesses: an account needs a company name, and the payment page asks for the company's address and tax number.
  3. Press “Create key”, choose the type Test and copy the key. It is shown one time. A test key costs nothing and works at once.
  4. Put the address and your key where your program reads them, and check the key.
No GTO Gecko account yet?

“Continue with Google” makes one. To sign in with an email address and a password, make a free account at play.gtogecko.com first and verify its email address. It is the account of the GTO Gecko app.

export GECKO_API="https://api.gtogecko.com"
export GECKO_KEY="gecko_test_..."

curl -sS "$GECKO_API/v1/account" -H "Authorization: Bearer $GECKO_KEY" | jq .
What comes back
Your account, with "env": "test" under key. A wrong key answers 401 invalid_key: paste the whole key in place of gecko_test_.... More in Keys and authentication.

Step 2 of 5

Describe the spot

A spot is a board, a pot, the stack behind, and one range for each player: out of position first, then in position. Save this as spot.json in your folder.

{
  "board": ["As", "Ks", "7h"],
  "pot": 100,
  "stack": 300,
  "ranges": [
    {"AA": 1, "KK": 1, "QQ": 1, "JJ": 1, "TT": 1, "99": 1, "88": 1, "77": 1, "66": 1,
     "55": 1, "44": 1, "33": 1, "22": 1, "AKs": 1, "AKo": 1, "AQs": 1, "KQs": 1, "JTs": 1},
    {"AA": 1, "KK": 1, "QQ": 1, "JJ": 1, "TT": 1, "99": 1, "88": 1, "77": 1, "66": 1,
     "55": 1, "44": 1, "33": 1, "22": 1, "AKs": 1, "AKo": 1, "AQs": 1, "AQo": 1, "AJs": 1,
     "KQs": 1, "QJs": 1, "T9s": 1}
  ],
  "bet_sizes": [0.33],
  "raise_sizes": [1.0]
}
The sizes
"bet_sizes": [0.33] is one bet of 33% of the pot. "raise_sizes": [1.0] is one raise of the pot. The all-in is on by default, so each player can also bet or raise all 300 chips.
What comes back
Nothing yet: this file is the body of the request in step 3. The spot lists every field you can send.

Step 3 of 5

Solve

POST /v1/solves answers 202 with a solve. Prefer: wait=30 holds the answer up to 30 seconds while the solver works. A solve is finished when its status is complete.

While it is pending, queued or running, ask again with GET /v1/solves/{id} and Prefer: wait=30. The helper wait_for in each sample does that. With a live key the first solve after a quiet period needs about 45 seconds, more than one wait: see warm and cold.

curl -sS -X POST "$GECKO_API/v1/solves" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
  -H "Prefer: wait=30" -d @spot.json -o flop.json

wait_for() {
  while jq -e '.status | IN("pending", "queued", "running")' "$1" > /dev/null; do
    curl -sS "$GECKO_API/v1/solves/$(jq -r .id "$1")" \
      -H "Authorization: Bearer $GECKO_KEY" -H "Prefer: wait=30" -o "$1"
  done
}
wait_for flop.json

FLOP=$(jq -r .id flop.json)
jq '{id, status}' flop.json
What comes back
A solve with "status": "complete", an id that starts with slv_, and result: the path of the answer. Every field is in the solve object.

Step 4 of 5

Read the answer

The result holds every decision of the street. Each decision lists its actions and, for each hand, one probability and one EV for each action. Here: what the hand AhKh does at the first decision.

curl -sS "$GECKO_API/v1/solves/$FLOP/result" \
  -H "Authorization: Bearer $GECKO_KEY" \
  --compressed -o flop-result.json

jq '.tree.strategy | {actions, plays: .strategy.AhKh, evs: .evs.AhKh}' flop-result.json
The actions
c is check or call. f is fold. b33 is a bet or raise that puts 33 chips in on the street. b300 is the all-in: the stack is 300.
What comes back
Three actions with a share and an EV each. With a live key the hand bets 33 chips 78% of the time and checks 22%. With a test key every action has the same share and EV 0. Results explains the whole format.

Step 5 of 5

Go on to the turn

Continue from the flop solve with the line that ended the street and the turn card. The line ["c", "b33", "c"] is: the first player checks, the second bets 33 chips, the first calls.

Then the 2 of clubs comes. Each street is one call.

curl -sS -X POST "$GECKO_API/v1/solves" \
  -H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
  -H "Prefer: wait=30" -o turn.json \
  -d "$(jq -n --arg parent "$FLOP" '{parent: $parent, line: ["c", "b33", "c"], card: "2c"}')"
wait_for turn.json

TURN=$(jq -r .id turn.json)
jq '{street, board, pot, stack, status}' turn.json
What comes back
A turn solve: board As Ks 7h 2c, pot 166, stack 267. Read its result as in step 4. The line is written in the tokens the answers use: see lines and their tokens.

Where to go next: three ways to get later streets, how to wait for a result, and the checklist in Going to production. A test key gives placeholder numbers: for real solutions, go live.