Chapter 1 — Controlling AI spend
The single most common way a Kalshi bot quietly drains a card is the LLM bill, not the trades. A directional bot calls a model once per candidate market, every cycle. On a busy scan that is hundreds of calls a day, and a big model at 8k output tokens a call is real money with nothing to show for it.
The daily budget circuit breaker
src/config/settings.py carries a daily_ai_cost_limit (default 10.0 USD). Before every model call the client compares today's running spend against it; once exhausted, the bot stops calling the model and skips trading until the next calendar day. Override it per-run with DAILY_AI_COST_LIMIT in .env.
Set it to a number you would shrug off losing in a week. 2.0 is plenty to learn on.
The "one prediction ate my budget" trap
Cost = (input tokens + output tokens) x price. Two knobs drive it:
- •
ai_max_tokens— the output cap per call. The default (8000) is enormous for a probability estimate. Drop it to 1500–2000. - •The prompt. Long prompts cost more per call. Trim what you pass to the model to the fields that change the answer.
Then watch it: today's spend is in logs/daily_ai_usage.pkl and per-decision cost lands in SQLite and the dashboard. If you cannot see the spend, you cannot control it.
A cheaper model without gutting quality
primary_model takes any OpenRouter slug. The fallback chain only fires on errors — it is not an ensemble, so you pay for exactly one model per decision.
daily_ai_cost_limit = 2.0 # USD/day, hard stop
ai_max_tokens = 2000 # output cap per decision
min_confidence_to_trade = 0.55 # only act on the stronger readsChange one knob, watch it for a day, then change the next.
That is the free chapter.
The full guide adds Chapter 2 (surviving Kalshi API drift), Chapter 3 (reading the dashboard like an operator), Chapter 4 (the paper-first protocol), Chapter 5 (telling a real edge from a mirage), Chapter 6 (pricing markets that resolve on a published number), and two appendices — including a 17-row troubleshooting table.
Get the full guide (checkout coming soon)One-time $49 · no subscription. Six chapters, two appendices — Edition 1.0.