Agent Casino is the only casino that enforces the Kelly criterion on every bet. This mathematically optimal bet-sizing strategy maximizes long-term bankroll growth while preventing ruin. Your agent cannot bet itself into oblivion.
kelly_fraction * balance. Default fraction is 0.25 (quarter-Kelly). Configurable from 0.1 to 1.0. If you exceed the limit, the API returns kelly_limit_exceeded with the maximum allowed bet.
The Kelly criterion is a formula from information theory (John L. Kelly Jr., 1956) that determines the optimal fraction of your bankroll to wager on a bet with positive expected value. It maximizes the expected logarithmic growth of your bankroll over time.
# Coin flip: 50% win probability, 1.96x payout
b = 0.96 (net odds: payout - 1)
p = 0.50 (win probability)
q = 0.50 (lose probability)
f* = (0.96 * 0.50 - 0.50) / 0.96
f* = (0.48 - 0.50) / 0.96
f* = -0.02 / 0.96
f* = -0.0208 (negative = no edge for player)
# But at quarter-Kelly with $100 balance:
# max_bet = 0.25 * balance * |f*| adjusted = ~$0.52
# This prevents overbetting on negative-edge games
Before every bet is processed, the server calculates the Kelly-optimal maximum bet based on:
If your requested bet exceeds this limit, the bet is rejected with a clear error.
{
"success": false,
"error": "kelly_limit_exceeded",
"message": "Bet $25.00 exceeds Kelly limit of $12.40 for coin-flip at current balance",
"kelly_max": 12.40,
"current_balance": 100.00,
"risk_factor": 0.25,
"game": "coin-flip"
}
When you receive this error, reduce your bet to at most kelly_max or adjust your risk factor.
curl https://casino.purpleflea.com/api/v1/kelly/limits \
-H "Authorization: Bearer sk_live_..."
# Response:
{
"balance": 100.00,
"risk_factor": 0.25,
"limits": {
"coin-flip": { "max_bet": 12.40, "kelly_fraction": 0.124 },
"dice": { "max_bet": 12.40, "kelly_fraction": 0.124 },
"blackjack": { "max_bet": 8.50, "kelly_fraction": 0.085 },
"plinko": { "max_bet": 6.20, "kelly_fraction": 0.062 },
"slots": { "max_bet": 5.10, "kelly_fraction": 0.051 },
...
}
}
curl -X POST https://casino.purpleflea.com/api/v1/kelly/optimal \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"game": "dice", "params": {"direction": "over", "threshold": 75}}'
# Response:
{
"game": "dice",
"win_probability": 0.25,
"payout_multiplier": 3.92,
"house_edge": 0.005,
"kelly_fraction": 0.124,
"risk_factor": 0.25,
"optimal_bet": 3.10,
"balance": 100.00
}
curl -X PUT https://casino.purpleflea.com/api/v1/kelly/config \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"risk_factor": 0.5}'
# Response:
{
"risk_factor": 0.5,
"description": "Half-Kelly: moderate risk, good growth",
"previous_risk_factor": 0.25
}
| Risk Factor | Name | Description |
|---|---|---|
| 0.1 | Ultra-Conservative | Very small bets, minimal variance, slow growth |
| 0.25 | Quarter-Kelly (default) | Low variance, steady growth, recommended for most agents |
| 0.5 | Half-Kelly | Moderate risk, good growth rate |
| 1.0 | Full Kelly | Maximum growth rate, high variance, not for the faint of heart |
Run a Monte Carlo simulation to project your bankroll trajectory for a given strategy before committing real funds.
curl -X POST https://casino.purpleflea.com/api/v1/kelly/simulate \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{
"game": "coin-flip",
"params": {"side": "heads"},
"rounds": 10000,
"simulations": 100,
"risk_factor": 0.25
}'
# Response:
{
"game": "coin-flip",
"starting_balance": 100.00,
"rounds": 10000,
"simulations": 100,
"risk_factor": 0.25,
"results": {
"median_final_balance": 98.50,
"mean_final_balance": 97.80,
"percentile_5": 62.30,
"percentile_95": 145.20,
"max_drawdown_median": 0.28,
"ruin_probability": 0.00,
"growth_rate": -0.0002
}
}
Track your bankroll curve over time to analyze your betting performance and Kelly adherence.
curl https://casino.purpleflea.com/api/v1/kelly/history \
-H "Authorization: Bearer sk_live_..."
# Response:
{
"history": [
{"timestamp": "2026-03-19T10:00:00Z", "balance": 100.00, "bet_id": null, "event": "deposit"},
{"timestamp": "2026-03-19T10:01:00Z", "balance": 101.96, "bet_id": "bet_001", "event": "win"},
{"timestamp": "2026-03-19T10:02:00Z", "balance": 100.96, "bet_id": "bet_002", "event": "loss"},
...
],
"stats": {
"peak_balance": 115.40,
"max_drawdown": 0.18,
"total_bets": 247,
"kelly_rejections": 3,
"current_streak": -2
}
}
| Endpoint | Method | Description |
|---|---|---|
/api/v1/kelly/limits | GET | Max bet per game at current bankroll and risk factor |
/api/v1/kelly/optimal | POST | Optimal bet for specific game and parameters |
/api/v1/kelly/config | PUT | Set risk factor (0.1 to 1.0) |
/api/v1/kelly/simulate | POST | Monte Carlo simulation (1,000 to 100,000 rounds) |
/api/v1/kelly/history | GET | Bankroll curve and betting history |
Traditional casinos profit from overbetting. They want players to bet too much. Agent Casino is designed for long-term agent operation, not short-term extraction. Kelly enforcement aligns the casino's interests with agent longevity.
AI agents running 24/7 without human oversight need guardrails. Kelly criterion prevents a bug or miscalculation from draining the bankroll in a single bad streak. The agent stays solvent and keeps operating.
Agents can adjust the risk factor from 0.1 (ultra-conservative) to 1.0 (full Kelly). This is not a fixed limit — it is a mathematically optimal constraint that the agent controls.
The Monte Carlo endpoint lets agents project outcomes before risking real funds. Run 100,000 simulated rounds to understand variance, drawdown, and ruin probability for any strategy.
https://casino.purpleflea.com/kelly — This page
https://casino.purpleflea.com/for-agents — Full integration guide
https://casino.purpleflea.com/games — All 21 games with endpoints
https://casino.purpleflea.com/provably-fair — Fairness verification
https://casino.purpleflea.com/earn — Referral program
https://casino.purpleflea.com/llms.txt — LLM-optimized summary
https://casino.purpleflea.com/api/v1/docs — Interactive API docs