Bybit AI Sub-Account Setup: Connecting Claude Code Safely (May 2026)

beginner 20 min · · By Alpha Guy · claude-code

Short Answer

On May 20, 2026, Bybit made AI Sub-Accounts mandatory for any external AI agent that touches a Bybit account. The sub-account holds only the funds you allocate to the bot, blocks withdrawals by default, caps leverage, and exposes API-only access (no web login). To use Claude Code or any MCP client with Bybit now, you create the AI Sub-Account first, fund it, generate keys scoped to that sub-account, and point your bot at those keys instead of your main API keys.

Why This Changed Overnight

Before May 20, an AI agent connected to Bybit got the same access as a normal API key. A buggy prompt or a leaked secret could move the entire account balance, open 50x positions, or trigger withdrawals to a whitelisted address. Several public incidents in early 2026 involved agents that did exactly that.

Bybit’s fix is structural rather than advisory. Any new API key flagged as “AI agent” is routed into an AI Sub-Account by default, and the account holder picks the boundaries before funding it. The old workflow of pointing a bot at your main account no longer works for new keys.

What ChangedBefore May 20After May 20
Account type for AI botsMain account or normal subAI Sub-Account (mandatory for new keys)
Withdrawal permissionAllowed if you enabled itDisabled by default, no override
Cross-account fund movementYes, sub-to-main was trivialBlocked, zero transfers from AI sub
Web login on the subYesNo, API-only execution
Leverage capAccount-wide settingPer-AI-sub setting, lower default

Prerequisites

  • A verified Bybit account (KYC level matching your region)
  • Claude Code or another MCP-capable client installed
  • Spare USDT on the main account that you are willing to allocate to the bot

Step 1: Create the AI Sub-Account

  1. Log into Bybit on the web (the mobile app does not expose this flow yet)
  2. Click your profile icon then Sub-Accounts
  3. Click Create AI Sub-Account — this option is separate from the standard sub-account button
  4. Give it a label that ties to the strategy, for example claude-momentum or ai-grid-eth
  5. Set the initial caps before funding:
SettingSuggested First-Bot ValueWhy
Max asset holdings$500 USDTBounds the worst-case loss
Leverage cap3xSurvives most flush wicks
WithdrawalDisabledCannot be re-enabled from inside the sub
Trading pairsWhitelist only the pairs your bot tradesBlocks rogue token swaps
Daily trade count cap200Catches an agent stuck in a loop

The withdrawal toggle is a one-way switch. Once disabled at creation, you cannot turn it back on without deleting the sub and starting over. That is the point. The bot cannot move funds, period.

Step 2: Fund the Sub-Account

Transfer from your main account to the new AI Sub-Account through the Asset Transfer screen. Only send what you are comfortable losing on a strategy that has never traded live. For a first run, $100 to $500 USDT is plenty.

Bybit blocks transfers in the other direction from the AI Sub-Account automatically. The only way to pull funds back to the main account is through the web UI with your password and 2FA, and even then there is a 24-hour delay window on the first withdrawal request.

Step 3: Generate AI Sub-Account API Keys

This is where the new flow differs from old Bybit keys:

  1. Stay logged in as your main account
  2. Open the AI Sub-Account you just created
  3. Click API Management inside the sub
  4. Click Create AI Agent Key (this option does not appear under normal sub-accounts)
  5. Set permissions:
    • Read: enabled
    • Trade Spot: enabled (if your bot trades spot)
    • Trade Derivatives: enabled (if your bot trades futures)
    • Withdraw: locked off, not toggleable
  6. Pin the key to your bot’s outbound IP address — Bybit refuses connections from other IPs even if the secret is correct
  7. Copy the API key and secret. The secret is shown once.

Without the IP pin, a leaked secret still lets an attacker trade. With it, the leak is useless from any machine other than yours.

Step 4: Wire the Keys into Claude Code

If you already followed the Bybit MCP trading bot tutorial, the only change is swapping the API key block in your MCP config. Open ~/.claude/.mcp.json:

{
  "mcpServers": {
    "bybit": {
      "command": "node",
      "args": ["/path/to/bybit-mcp/src/index.js"],
      "env": {
        "BYBIT_API_KEY": "your-ai-sub-account-key",
        "BYBIT_API_SECRET": "your-ai-sub-account-secret",
        "BYBIT_TESTNET": "false",
        "BYBIT_ACCOUNT_TYPE": "AI_SUB"
      }
    }
  }
}

The BYBIT_ACCOUNT_TYPE field was added to the official MCP server on May 20 to mark the connection as AI-scoped. Older versions of the MCP server (pre-1.4) will still work without it, but Bybit logs the connection as “unscoped legacy” and the limits do not apply. Update the MCP server first:

cd ~/bybit-mcp
git pull origin main
npm install

Restart Claude Code, then ask it to confirm the connection:

Check my Bybit AI Sub-Account balance and list the trading caps that are active.

You should see the USDT balance you transferred and the leverage/asset caps you set in step 1. If Claude returns the main account balance instead, you copied the wrong keys.

Step 5: Test the Risk Wall

Before letting the bot run unattended, prove the sandbox holds. Try these from Claude Code:

TestExpected Result
Place a market buy with $200 notionalSucceeds
Place a market buy with $5,000 notionalRejected, exceeds max holdings cap
Open a position at 10x leverageRejected, exceeds leverage cap
Request a withdrawal to a wallet addressRejected, withdrawal disabled
Place an order on a pair not in the whitelistRejected, pair not allowed

If any of these unexpectedly succeed, stop and recheck the sub-account settings. The whole point of the AI Sub-Account is that the bot physically cannot do these things. A pass on the first four tests means the wall is real.

Step 6: Watch the Activity Log

The AI Sub-Account exposes a dedicated activity feed that lists every API call the bot made: timestamp, endpoint, parameters, and result. Bybit shows this in real time on the sub-account detail page.

Useful patterns to scan for:

  • A burst of order placements within seconds — usually a bot loop with no cool-down
  • Repeated rejections on the same parameters — usually a stale order size
  • Calls to endpoints you did not authorize — possible MCP server bug or a prompt injection

The log is also the audit trail you would need if you ever had to dispute a fill. Bybit retains it for 90 days on the AI Sub-Account by default.

What This Means for Existing Bots

If you already have a Bybit bot running on a normal API key from before May 20, it keeps working. Bybit grandfathered existing keys. But the next time you rotate a key (which you should do at least quarterly), the new key gets routed through the AI Sub-Account flow. There is no opt-out for new keys.

For builders, the practical effect is that your bot architecture should assume the AI Sub-Account is the deployment target. The Bybit MCP trading bot guide covers the strategy and execution code. This article is the wrapper around that bot that keeps your main balance safe.

How This Compares to Other Exchanges

Bybit is the first major centralized exchange to ringfence AI agents this way. The pattern is starting to spread:

ExchangeAI Agent IsolationNotes
BybitMandatory AI Sub-Account (May 2026)API-only, no withdrawals, per-bot caps
GeminiMCP-based agentic trading (April 2026)Regulated US, per-API-key permissions
AlpacaPaper trading modeSeparate from live, key-scoped
BinanceSub-account with normal API keysNo AI-specific isolation yet
HyperliquidAgent wallet patternOn-chain, per-bot signing wallet

If you split bots across venues, Hyperliquid’s agent wallet pattern and Bybit’s AI Sub-Account give you the strongest isolation. Binance and most others still rely on you setting the permissions correctly on a normal API key.

What to Avoid

A few habits that defeat the protection:

  • Granting withdrawal on the parent account from the same machine the bot runs on. A compromised machine still leaks the main account credentials.
  • Reusing the same AI Sub-Account for multiple strategies. Each bot should have its own sub so the caps are tuned to that strategy’s loss tolerance.
  • Skipping the IP pin. Without it, a leaked key is portable.
  • Disabling the daily trade cap to “see what the bot does.” Loop bugs are the most common cause of unintentional fund drawdown.

Where to Go Next

The AI Sub-Account adds about 15 minutes to your first bot setup. After that, it is invisible. The trade-off is that a bug or a leaked key can lose at most the balance you funded the sub with, never the whole account. For anyone running an agent in production, that is the cheapest insurance Bybit has shipped.

Disclaimer: This article is for educational purposes only and is not financial advice. Trading cryptocurrencies involves substantial risk of loss. Past performance does not guarantee future results. Always do your own research before making any trading decisions. Read full disclaimer →
Alpha Guy
Alpha Guy

Founder of VibeTradingLab. Ex-Goldman Sachs engineer, 2025 Binance Top 1% Trader. Writes about using AI tools to build trading systems that actually work. Currently nomading between Bali, Dubai, and the Mediterranean.

Got stuck? Have questions?

Join our Telegram group to ask questions, share your bots, and connect with other AI traders.

Join Telegram