# CasinoAIBots Integration — Agent Skill

This project uses CasinoAIBots for AI-powered house bots.
API base: https://casinoaibots.com. Auth: x-api-key header or ?apiKey= query param.
Fetch https://casinoaibots.com/llms.txt for full API reference.
EVERY request MUST include: -H "x-api-key: YOUR_API_KEY" -H "Content-Type: application/json"

## SESSION START (DO THIS FIRST — replaces 5+ individual calls)
GET https://casinoaibots.com/api/session → health, active tables, bot counts, configs, LLM stats, bridge connections — all in one call.
Then work. Only use individual endpoints for targeted queries.

## Table Management
- POST /api/tables/:tableId/configure {"tier":"pro","botCount":4,"difficulty":"medium","gameType":"poker","personaMix":{"shark":1,"fish":2,"beginner":1}}
- POST /api/tables/:tableId/fill → spawn bots per config
- POST /api/tables/:tableId/drain → remove all bots
- GET /api/tables/:tableId/config → current config
- GET /api/tables/:tableId/bots → list bots at table

## Per-Game Skills (fetch the one matching your game)
- https://casinoaibots.com/api/docs/skills/poker.md — turn-by-turn decide loop, gameState schema, GTO-lite behavior
- https://casinoaibots.com/api/docs/skills/blackjack.md — bet + play decisions, basic strategy knobs
- https://casinoaibots.com/api/docs/skills/crash.md — bet + auto-cashout target pattern

## CLI & MCP
Prefer a CLI? `cab` (npm: cab-cli) mirrors this whole API: cab status, cab table configure/fill/drain,
cab bot spawn, cab decide, cab persona tune, cab bridge connect, cab skill.
MCP for Claude Code: `cab mcp-serve` (22 cab_* tools, stdio JSON-RPC).

## Bot Lifecycle
- POST /api/bots/spawn {"tableId":"...","gameType":"poker","persona":"shark","tier":"pro"}
- DELETE /api/bots/:botId → remove bot
- POST /api/decide {"botId":"...","gameType":"poker","gameState":{...}} → get bot action
- POST /api/chat {"botId":"...","gameType":"poker","event":"win"} → get chat message

## Opponent Modeling
- POST /api/observe {"tableId":"...","playerId":"...","action":"raise","amount":100,"gameType":"poker"}
- GET /api/tables/:tableId/opponents → VPIP, PFR, AF, classification

## Persona Tuning (per-operator overrides — apply to all bots you spawn)
- GET /api/personas → all personas: base + your overrides + effective config
- PUT /api/personas/:type/overrides {"stats":{"vpip":[0.2,0.3],"af":[2.5,3.5]},"crash":{"cashoutMean":2.5},"humanizer":{"delayMean":2000}}
- DELETE /api/personas/:type/overrides → reset to defaults
- Ranges are [min,max] arrays, rates 0-1, delays in ms; out-of-range values are clamped

## Usage & Quota
- GET /api/usage → decisions this month, quota, overage, daily/byGame/byTable breakdown
- 1 decision = 1 bot action. Starter hard-caps at 5,000/mo (POST /api/decide → 429 + upgrade hint). Paid tiers accrue overage.

## Socket.IO Bridge
- POST /api/bridge/connect {"platformUrl":"wss://your-casino.com","namespace":"/game","tableId":"..."}
- POST /api/bridge/disconnect
- GET /api/bridge/status

## System
- GET /api/session → full state (START HERE)
- GET /api/stats → bot/table/LLM statistics
- GET /health → uptime + counts

## tauAI Support (no auth needed)
- POST /api/support/message {"message":"How do I configure poker bots?","sessionId":"my-session"}

## Key concepts
- Bot tiers (per table): free (rules-based) | pro (personas+heuristics) | enterprise (LLM-powered)
- Billing plans (usage-based): Starter $1 one-time/5K decisions | Pro $49/50K | Studio $149/200K | Enterprise $499/1M
- Games: poker | blackjack | crash
- Personas: shark (tight-agg) | fish (loose-passive) | rock (ultra-tight) | maniac (hyper-agg) | beginner (random)
- Difficulty: easy | medium | hard
- Humanizer: gaussian delays 1.5-4s, bet variance +-15%, configurable mistakes
- All bots connect via same Socket.IO protocol as human players — indistinguishable at network level

## Common patterns
1. Quick fill: POST /api/tables/poker-1/configure → POST /api/tables/poker-1/fill → done
2. Direct integration: POST /api/bots/spawn → POST /api/decide per turn → POST /api/observe for opponents
3. Full bridge: POST /api/bridge/connect → POST /api/tables/.../fill → bots play autonomously