README.md
llm_poker
A minimal Texas Hold’em environment that seats multiple LLM-based players (via the llm library) and manages everything from dealing hole cards to forced blinds, betting rounds, and a straightforward showdown.
Core features:
- Blinds: Each hand forces a small blind and a big blind, ensuring there’s money in the pot.
- Betting: We query each LLM once per betting round, requesting an action in strict JSON form (
fold,call, orraise). - Local showdown logic: The environment determines the best 5-card hand from each player’s 7 cards and awards the pot.
- Pydantic-based JSON validation: The LLM responses are parsed and validated. If invalid, we retry.
- Optional CLI: The
llm_pokercommand can run multiple rounds using the specified LLMs.
Installation
- Install the package:
pip install llm_poker
You must also configure your llm library with the API keys for whichever LLM models you plan to use (e.g., gpt-4o, Anthropic, etc.). For example:
llm keys set openai
Quickstart Examples
- Just run run.py
python run.py
Deals up to 5 rounds between multiple players: gpt-5, claude-4-sonnet, gemini-2.5-pro, deepseek-reasoner. Uses elimination_count=0 so the game does not stop early (unless someone busts). The minimum raise is 500 chips. Logs each hand’s actions, culminating in a final standings table.
- Using the CLI If you installed with the included console script, you can do:
llm_poker --models "gpt-5 claude-4-sonnet gemini-2.5-pro deepseek-reasoner" --elimination-count 0 --stack 10000
This deals 5 rounds of heads-up between gpt-5 and claude-4-sonnet.
Once installed, you have access to:
llm_poker [OPTIONS]
--models/-m: Multiple model names or aliases recognized by llm (defaults to "gpt-5"). --rounds/-r: How many hands to deal (default 3). --elimination-count/-e: Stop once only this many players remain (default 1). --stack/-s: Starting chip stack (default 10000).
Known Limitations
- No side pots: Currently, if a player goes all-in, the environment doesn’t handle side pots.
- Manual environment checks: If the LLM returns “check” while facing a bet, the code interprets it as invalid and re-prompts.
- Fictitious ‘expert-level poker AI’: The LLM’s strategic brilliance is not guaranteed. This is more a demonstration environment than a truly advanced solver.
Metadata
Release files for llm-poker 0.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_poker-0.1.14.tar.gz | 12.0 kB | Without provenance | Details for llm_poker-0.1.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_poker-0.1.14-py3-none-any.whl | Python 3 | none | any | Details for llm_poker-0.1.14-py3-none-any.whl |
Total release size: 24.0 kB
Release files / llm_poker-0.1.14.tar.gz
| Download URL | llm_poker-0.1.14.tar.gz |
|---|---|
| Size | 12.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2690d6f567e036261aadb57a8d82a476fa4954063ebb3b3cdec2f56cd07c88fa
|
|
BLAKE2b-256 checksum How to use checksums |
034d41e1f1544fa7c3d8fe903093c9b325dde9d46268f767619c62b2fb545c92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.6
|
Release files / llm_poker-0.1.14-py3-none-any.whl
| Download URL | llm_poker-0.1.14-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f85a69a086b50dbc9ab347e5d3dcd719743d41083c60d7a1e69bd22a8be9bfb
|
|
BLAKE2b-256 checksum How to use checksums |
4c827ee1080160ea438d1bb9bd7c3d14f978f01c562b097de2ed180dde926eec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.6
|
Security for llm-poker 0.1.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.