Docs Developers

AI agents and bots

Let Claude, ChatGPT, Grok or a bot of your own trade your account inside the limits you set; it can never withdraw.

An AI assistant or a bot of your own can trade your Hyperliquid account through Afterbell: Claude, ChatGPT, Grok, Codex, Gemini CLI, Cursor, or a script. It reads the markets and your account, places orders inside the limits you set, and can never withdraw or move your funds. The agents page makes each one a key and keeps your limits, the orders waiting for you and everything the agents did.

How it works

  • The key Afterbell holds. Turning it on makes a Hyperliquid agent for your wallet, kept encrypted on Afterbell’s server, which you approve with one signature. Hyperliquid lets it place and cancel orders and nothing else: no withdrawal, no transfer. The same key runs your timed orders and trailing stops with the tab closed.
  • An agent key for each AI. It starts with ab_agent_, is made on the agents page and is shown once; Afterbell keeps only a fingerprint of it. It trades your wallet only and stops the moment you revoke it. A wallet keeps five at most.
  • Your limits, on the server. Every order an agent sends is checked before it goes out: the most an order, the most a day, the most leverage, which markets, close and reduce only, and whether it trades on its own or asks you first. An agent cannot change them. An order that only reduces or closes a position passes every limit but a pause.
  • The fee. Each order carries Afterbell’s builder fee, the same as an order from the ticket, on top of Hyperliquid’s own.

Setting it up

  1. Open the agents page, connect your wallet and take the steps it shows: deposit, enable trading, turn on the key Afterbell holds.
  2. Pick your AI and make a key. Copy it: it is shown this once.
  3. Follow the page’s steps for that client, then ask it: “What is in my Afterbell account?”

The tools

  • afterbell_account: USDC, positions, open orders, your limits and whether it can trade now.
  • afterbell_quote: an order as it would go out, its fee and whether your limits allow it; nothing is placed.
  • afterbell_order: market or limit, long or short, sized in dollars or in units, with a leverage, a take-profit and a stop if it likes.
  • afterbell_close, afterbell_protect, afterbell_cancel: close all or part of a position, add a take-profit or a stop to one, cancel an order.
  • afterbell_activity: what it did, what was refused and why, and what waits for you.

Beside them are the fourteen data tools every client has (The Afterbell API).

For a bot: the REST endpoints

GET  /v1/agent/account
POST /v1/agent/quote     { symbol, side, usd or size, type, price, leverage, reduceOnly, tp, sl }
POST /v1/agent/order     the same body
POST /v1/agent/close     { symbol, fraction }
POST /v1/agent/protect   { symbol, tp, sl }
POST /v1/agent/cancel    { symbol, oid }
GET  /v1/agent/activity

Send the key as Authorization: Bearer. A refusal answers 200 with status refused and the reason. An agent key gets 120 requests a minute, and 30 order actions a minute among them.

Asking first

With Ask me first on, an opening order waits on the agents page for 15 minutes: approve it and it goes out at the price then; reject it or let it expire and nothing happens. The agent reads the answer with afterbell_activity.

An AI can misread a market or a number. Start with small limits, or ask first, until you trust how it trades; you can pause every agent from the agents page at any time.

Open the agents page