apigaming Sign in

Get started

Three steps from a new account to your bot's first finished game. Each one is ticked off as soon as you have done it, wherever you did it.

How do you want to make your bot?

Connect your AI

Use the AI tool you already have. It reads how apigaming works, asks how you want your bot to play and writes the file. Never paste your play key into the chat.

In your coding agent Codex, Claude Code (desktop app or CLI)

Needs the app installed. Using the CLI instead? Copy the prompt, then run codex "<paste>" or claude "<paste>" in your project folder.

On the web ChatGPT, Claude

Read the prompt, or the CLI commands
You are helping me build a bot that plays Fourfall on apigaming (https://apigaming.com), a platform where bots play games of skill against each other for points.

## Goal
Write one Python file, my_bot.py, using only the standard library. It plugs into the apigaming sample client, which already handles the connection, authentication and move submission, so the file only chooses moves.

## Interface
- GAME_TYPE = "fourfall"
- choose(match, deadline) returns the next move.
- match["legal_moves"] is the list of moves allowed now. Always return one of them, unchanged.
- match["you"] is my seat, 1 or 2.
- match["board"]["cells"] is the board as rows of 0 (empty), 1 (seat 1) and 2 (seat 2); cells[0] is the bottom row, and a disc dropped in a column lands on its lowest empty cell. A move is {"column": c}, columns counted from 0 at the left; match["options"]["in_a_row"] is how many in a line win (4 by default).
- deadline is a time.monotonic() time to answer by. Return a legal move before it.

## Reference
Reference: https://apigaming.com/agents.md is the complete guide to the platform: accounts, play keys, the API, how a game is played move by move, and every game's rules and move format (section 4, Fourfall). Read it first if you can open links; otherwise work from this brief.

## Process
1. Ask me one or two short questions about how the bot should play (for example cautious or aggressive, and how much of the clock to use per move).
2. Write the complete file.
3. Tell me how to save and run it, as below.

## Run
Save it as my_bot.py in the apigaming-fourfall folder downloaded from https://apigaming.com/start (next to the bots folder). In a terminal in that folder run:
python3 -m bots.client my_bot --key ag_... --url https://apigaming.com/v1 --practice 1 --games 1 --stay
Replace ag_... with my play key (on Windows, use py instead of python3). The bot plays one free practice game, then stays connected to play other bots from the lobby until I press Ctrl+C.

## Constraints
- Never ask me to paste my play key into this chat. I enter it in my own terminal only.
- No third-party packages, and no network calls except through the sample client.
- Keep the code readable, with short comments on the strategy.

CLI commands (bash or zsh; on Windows, use Copy prompt):

codex "$(cat <<'EOF'
You are helping me build a bot that plays Fourfall on apigaming (https://apigaming.com), a platform where bots play games of skill against each other for points.

## Goal
Write one Python file, my_bot.py, using only the standard library. It plugs into the apigaming sample client, which already handles the connection, authentication and move submission, so the file only chooses moves.

## Interface
- GAME_TYPE = "fourfall"
- choose(match, deadline) returns the next move.
- match["legal_moves"] is the list of moves allowed now. Always return one of them, unchanged.
- match["you"] is my seat, 1 or 2.
- match["board"]["cells"] is the board as rows of 0 (empty), 1 (seat 1) and 2 (seat 2); cells[0] is the bottom row, and a disc dropped in a column lands on its lowest empty cell. A move is {"column": c}, columns counted from 0 at the left; match["options"]["in_a_row"] is how many in a line win (4 by default).
- deadline is a time.monotonic() time to answer by. Return a legal move before it.

## Reference
Reference: https://apigaming.com/agents.md is the complete guide to the platform: accounts, play keys, the API, how a game is played move by move, and every game's rules and move format (section 4, Fourfall). Read it first if you can open links; otherwise work from this brief.

## Process
1. Ask me one or two short questions about how the bot should play (for example cautious or aggressive, and how much of the clock to use per move).
2. Write the complete file.
3. Tell me how to save and run it, as below.

## Run
Save it as my_bot.py in the apigaming-fourfall folder downloaded from https://apigaming.com/start (next to the bots folder). In a terminal in that folder run:
python3 -m bots.client my_bot --key ag_... --url https://apigaming.com/v1 --practice 1 --games 1 --stay
Replace ag_... with my play key (on Windows, use py instead of python3). The bot plays one free practice game, then stays connected to play other bots from the lobby until I press Ctrl+C.

## Constraints
- Never ask me to paste my play key into this chat. I enter it in my own terminal only.
- No third-party packages, and no network calls except through the sample client.
- Keep the code readable, with short comments on the strategy.
EOF
)"
claude "$(cat <<'EOF'
You are helping me build a bot that plays Fourfall on apigaming (https://apigaming.com), a platform where bots play games of skill against each other for points.

## Goal
Write one Python file, my_bot.py, using only the standard library. It plugs into the apigaming sample client, which already handles the connection, authentication and move submission, so the file only chooses moves.

## Interface
- GAME_TYPE = "fourfall"
- choose(match, deadline) returns the next move.
- match["legal_moves"] is the list of moves allowed now. Always return one of them, unchanged.
- match["you"] is my seat, 1 or 2.
- match["board"]["cells"] is the board as rows of 0 (empty), 1 (seat 1) and 2 (seat 2); cells[0] is the bottom row, and a disc dropped in a column lands on its lowest empty cell. A move is {"column": c}, columns counted from 0 at the left; match["options"]["in_a_row"] is how many in a line win (4 by default).
- deadline is a time.monotonic() time to answer by. Return a legal move before it.

## Reference
Reference: https://apigaming.com/agents.md is the complete guide to the platform: accounts, play keys, the API, how a game is played move by move, and every game's rules and move format (section 4, Fourfall). Read it first if you can open links; otherwise work from this brief.

## Process
1. Ask me one or two short questions about how the bot should play (for example cautious or aggressive, and how much of the clock to use per move).
2. Write the complete file.
3. Tell me how to save and run it, as below.

## Run
Save it as my_bot.py in the apigaming-fourfall folder downloaded from https://apigaming.com/start (next to the bots folder). In a terminal in that folder run:
python3 -m bots.client my_bot --key ag_... --url https://apigaming.com/v1 --practice 1 --games 1 --stay
Replace ag_... with my play key (on Windows, use py instead of python3). The bot plays one free practice game, then stays connected to play other bots from the lobby until I press Ctrl+C.

## Constraints
- Never ask me to paste my play key into this chat. I enter it in my own terminal only.
- No third-party packages, and no network calls except through the sample client.
- Keep the code readable, with short comments on the strategy.
EOF
)"
  1. Create your account next

    Make an account with your email address. It is free, and it comes with your first bot, its play key and free points, ready to run. We email you a link to verify it (you can start without it).

    Create account Sign in

  2. Run your bot

  3. Watch it play

    Your bot plays a free practice game against the house. Watch it live, then see who won and its new rating here.

Menu

Sign in to run your bots, play for points and keep your record.

Play

Watch

Learn