Skip to content
5-MINUTE

Polymarket US 5-minute Bitcoin, every window live

5-minute board · results

FED DESK

Kalshi vs Polymarket vs futures on the next FOMC decision

Fed Rate Tracker · live

15-MINUTE

Every Kalshi 15-minute window, priced against the late-flip risk

Bitcoin · gold · silver · oil

MIDTERMS

Every 2026 race priced on Kalshi and Polymarket

Senate · House · governors

COMBO EDGE

Correlation-aware Kalshi combos — free

Kalshi Trading Bot Setup: API Keys, a Copy-Paste AI Prompt, and Funding It Safely

Hook a trading bot up to Kalshi step by step: create the API key, build the bot with a copy-paste AI prompt, test it on Kalshi's demo exchange, then fund it with hard caps.

Share
Kalshi bot setup card: three gold nodes labeled ingest, math and trade, above a data strip reading API key, demo exchange, dry-run and the PMP Bot Playbook.
Kalshi bot setup card: three gold nodes labeled ingest, math and trade, above a data strip reading API key, demo exchange, dry-run and the PMP Bot Playbook.
FSWA Award Winner · Published Author · Ran 4Deep Sports · Led FTN Marketing · Traded Bonds on Wall Street
December 2, 2026

Use these tools

Kalshi has the deepest public API of the prediction markets, which is why it's where most people build their first bot, and where we built ours. Here's the whole path from a blank account to a capped bot placing its first order.

New to the overall setup? Start with the prediction market bot overview, then come back.

Step 1: connect your Kalshi account

Open and verify a Kalshi account at kalshi.com (or through our link). API keys come from the account, so it has to be fully verified first.

Create the API key.

  1. Go to Profile Settings and find API Keys.
  2. Click Create New API Key and give it a name you'll recognize, like btc-bot.
  3. Kalshi shows you a Key ID and downloads a private key file (PEM format, saved as a .txt).

That private key download happens once. Kalshi doesn't store it, so if you lose it, you delete the key and make a new one. New keys default to Ed25519; RSA is still offered.

Store it like a password. Move the file somewhere outside your code folder, for example ~/.kalshi/btc-bot.pem, and point the bot at it with an environment variable. Never commit it to GitHub and never paste it into a chat.

How signing works, so the AI's code makes sense to you. Every request carries three headers:

HeaderWhat goes in it
KALSHI-ACCESS-KEYYour Key ID
KALSHI-ACCESS-TIMESTAMPThe current time in milliseconds
KALSHI-ACCESS-SIGNATUREBase64 signature over timestamp + METHOD + path (path without the query string)

Ed25519 keys sign that string directly. RSA keys sign it with RSA-PSS and SHA-256.

Two environments:

  • Production: https://api.elections.kalshi.com/trade-api/v2
  • Demo: https://external-api.demo.kalshi.co (separate demo account and separate keys, fake money)

Build against demo first. It's free, and it's where you find out your bot sends the wrong side.

Step 2: build the bot with AI

Paste this into Claude or ChatGPT. Fill in the market and your rule. It already knows Kalshi's auth.

You are a senior engineer helping me build a small, safe Kalshi trading bot.

Venue: Kalshi Trade API v2.
- Production base URL: https://api.elections.kalshi.com/trade-api/v2
- Demo base URL: https://external-api.demo.kalshi.co (use this while KALSHI_ENV=demo)
- Docs: https://docs.kalshi.com

Auth: every request sends KALSHI-ACCESS-KEY (Key ID), KALSHI-ACCESS-TIMESTAMP (ms)
and KALSHI-ACCESS-SIGNATURE = base64 signature of timestamp + METHOD + path
(path without query params). My key type is [Ed25519 / RSA]. For RSA, sign with
RSA-PSS, SHA-256, MGF1 SHA-256, salt length = digest length.
Read KALSHI_KEY_ID and KALSHI_PRIVATE_KEY_PATH from environment variables.
Never print or log the key. Never ask me to paste it here.

Market: [e.g. Bitcoin 15-minute up/down markets, series KXBTC15M].
Rule: [YOUR RULE, e.g. "buy YES when the model price beats the best ask by 8 cents"].

Build:
1. [Python 3.12 / Node 24]. No axios. Official SDK or the standard library.
2. ingest.py/js: list open markets for the series, read the order book, and
   reject data older than [N] seconds.
3. decide.py/js: apply my rule, return side, limit price in cents, and contract count.
4. execute.py/js: place limit orders via POST /portfolio/orders with a unique
   client_order_id. Check fills. Cancel anything still resting at window close.
5. Rails in config.yaml: max_dollars_per_position, max_open_positions,
   daily_loss_stop, and a KILL file that halts everything.
6. DRY_RUN=true by default. Log every decision and skip to decisions.csv with a reason.
7. Backoff on 429s and reconnects. Stale data = no trade.
8. If you are unsure of an endpoint or field name, say so and point me to the
   section of docs.kalshi.com to check. Do not invent endpoints.

List the files first, then write them one at a time. Finish with a test plan:
demo-exchange test, dry-run against production prices, and what the log should show.

Before you arm it, ask the AI to walk you through execute line by line, and to write tests for the rails. Fees matter here too: Kalshi charges a per-contract fee on every fill, so plug your typical edge into the Kalshi fee calculator before you trust a thin one.

Step 3: fund it and fence it

Deposit from the Kalshi app or site with any of the methods Kalshi lists on its deposit page. Kalshi doesn't have subaccounts, so the fence lives in your code:

  • Max per position. Our Kalshi BTC 15-minute lanes started at $3 max per position.
  • Daily loss stop. Ours started at $25 a day: hit it and the bot stops until tomorrow.
  • Lifetime stop and a kill switch. One file or one database flag that stops every order.
  • Keep the bot balance small. Deposit what the bot is allowed to lose, not your whole stack.

Then: demo first, dry-run against real prices second, live at minimum size third. Raise size only after the order log earns it.

Step 4: start with our stuff

Our Kalshi bot trades Bitcoin's 15-minute windows at small size, in public. Here's its record:

Our bot on Kalshi, live

R-TOP-OF-HOUR-MOM v4
Settled positions
196
Won–lost
70–126
Net after fees
+$83.85

Live at small size on our own Kalshi account since October 10, max $3 a position. This version of the strategy. Strategies evolve. They stay until they break. We watch the overall regime. The full record →

The reads behind it are free on the site:

Want to copy how ours is wired? The Bot Playbook is the build sheet for our three-machine setup: a Fly server that ingests prices, an engine that does the math, and a bot that places only what the math recommends. Get it with Pro →

Other venues: Polymarket US · Novig · ProphetX

Bots lose money too. Start small, log everything, and trade responsibly.

Share

Kalshi Trading Bot Setup: API Keys, a Copy-Paste AI Prompt, and Funding It Safely — frequently asked

Does Kalshi allow trading bots?

Kalshi publishes a public trading API with REST and WebSocket access, and programmatic trading through it is how bots connect. Read Kalshi's terms before you automate, and use the official API rather than browser automation.

How do I get a Kalshi API key?

Go to Profile Settings on kalshi.com, find API Keys and click Create New API Key. Kalshi gives you a Key ID and downloads a private key file once. It does not store the private key, so if you lose it you create a new key.

How does Kalshi API authentication work?

Every request carries three headers: KALSHI-ACCESS-KEY (your Key ID), KALSHI-ACCESS-TIMESTAMP (milliseconds) and KALSHI-ACCESS-SIGNATURE, a base64 signature over the timestamp, the HTTP method and the path without query parameters. New keys default to Ed25519; RSA keys sign with RSA-PSS and SHA-256.

Does Kalshi have a test environment?

Yes. Kalshi runs a demo exchange with its own API at external-api.demo.kalshi.co, so you can test order placement without real money. Demo keys and production keys are separate.

What can a Kalshi bot trade?

Anything listed on Kalshi that your rule covers. Bitcoin's 15-minute and hourly markets are popular with bots because they settle often and on a public index. Our Kalshi BTC 15-minute bot trades those windows at small size, and its record is on this page.

Read Next

Related: Kalshi vs Polymarket US · Is Polymarket US legal?

Pro: Thee Oracle — the three markets worth watching right now· $111 your first year →

Prediction-market edges, weekly. The only newsletter built for Kalshi & Polymarket traders.

No spam. Unsubscribe anytime.

Watch The 7 Oracles make the call. Full breakdowns on YouTube, quick hits on X.

Benny Ricciardi

Founder · The 7 Oracles

Benny Ricciardi is an FSWA Award Winner and published author. He ran 4Deep Sports as CEO, led marketing at FTN Network as CMO, and traded bonds on Wall Street. He founded PredictionMarketsPicks.

Follow @BennyR11 →
kalshi trading botkalshi api botkalshi api keyhow to make a kalshi botkalshi api pythonkalshi bot setupkalshi demo apikalshi 15 minute botautomate kalshi trading

Want more analysis like this?

Get The 7 Oracles' daily prediction market breakdown — free, no fluff, straight to your inbox.

Get the daily edge in your inbox →