Configuring OKX API Keys
The API Key is the credential that lets TodoAI talk to your OKX account. Once configured, all "place order / cancel / check balance" actions can actually execute.
Recommended flow
1. Create an API key on OKX
Follow the detailed OKX steps below.
2. Paste into TodoAI and save
Sidebar gear → pick the mode (Paper / Real) → fill three fields → save
3. Auto-test connection
Saving triggers it — a green "Connection OK · X USDT · Y open orders" means you're connected
4. Run strategies
Once connected, the engine places orders through these keys on every tick
Create an API key on OKX (step by step)
Live API Key
- Sign in to OKX → avatar (top right) →
API - Click
Create API Key→ chooseAPI Trading - Name it (anything, e.g.
TodoAI-Web) - Permissions: tick
Read+Trade. Do NOT tickWithdraw— non-negotiable. - Passphrase: set your own — this is what you'll paste into TodoAI as "Passphrase". OKX does not show it in plain text later
- IP Whitelist: by default TodoAI does not require a fixed server IP. If you restrict it, add the server's outbound IP; otherwise leave it open
- After creation, the page shows
API Key+Secret Key+Passphrase. The Secret is shown exactly once — copy it into a password manager - Paste all three into TodoAI's Configure modal → click
Test Connection
Paper / Demo API Key
⚠️ Most common pitfall: paper API keys must be created at OKX Demo Trading, NOT the main OKX site.
- On the Demo Trading page, avatar →
Demo API - Same steps as above. The demo account has 100k virtual funds
- Back in TodoAI, fill the keys into the Paper tab
What are the three fields?
| Field | Source |
|---|---|
| API Key | The string shown at the top of the OKX creation page (typically 36 chars) |
| Secret Key | The Secret OKX shows at creation, usually starting with "OK-"; shown exactly once |
| Passphrase | The one you set yourself when creating the API — not your OKX login password, not your funds password |
💡 There's a
?tooltip next to the Passphrase field. Hover it for the explanation.
Test connection failed — what now?
After saving, TodoAI automatically runs a connection test. On failure it tells you exactly what's wrong:
| Message | How to fix |
|---|---|
API Key invalid or deleted | Re-copy the Key from OKX |
Passphrase is wrong | You might be using the login password; use the one you set at creation |
Server IP not in OKX whitelist | Disable the whitelist, or add the server IP |
API Key lacks required permissions | Enable Read + Trade; do NOT enable Withdraw |
Signature invalid | Secret may be truncated — paste the full string |
Request timestamp expired | Clock skew; refresh and retry (usually transient) |
Pre-live checklist
- [ ] Strategy has been running on Paper for some time and performs as expected
- [ ]
/riskhas max-drawdown and global stop-loss set - [ ]
/backtesthas been run - [ ] API Key ticks
Read+Trade, NOTWithdraw - [ ] You are not on an unfamiliar network or public Wi-Fi when saving the Key
- [ ] You know where the
Panicbutton is (bottom of Sidebar)
Clearing stored keys
If you need to rotate or reset, click Clear stored keys at the bottom-left of the Configure modal. A confirmation pops up; confirming only clears the keys for the current mode + current exchange, the other mode is unaffected.
Common misconceptions
- "My key works on OKX, why is it failing here?" — Most likely an IP whitelist or permission issue, not the Key itself
- "I want two accounts running side by side" — Each account needs its own wallet; wallet address is the identity
- "Paper went well, so live will too" — Liquidity and matching differ slightly from mainnet. Watch the first days after switching to REAL closely