Pay-per-request Hyperliquid trading data for AI agents and bots.
USDC payments via x402 on HyperEVM. No accounts. No API keys.
Two services. The resource server serves trading data behind a paywall. The facilitator verifies EIP-3009 payment signatures and settles USDC transfers on-chain. Your agent never pays gas.
Express API with x402 payment middleware. Returns 402 Payment Required with signing instructions. On valid payment, serves real-time Hyperliquid data.
Verifies EIP-3009 transferWithAuthorization signatures off-chain, then executes the USDC transfer on HyperEVM. Pays all gas.
| Endpoint | Description | Parameters | Price |
|---|---|---|---|
| GET /mids | Mid prices for all Hyperliquid perpetuals | — | $0.001USDC |
| GET /orderbook | L2 orderbook with bids and asks | ?coin=ETH | $0.001USDC |
| GET /funding | Predicted & historical funding rates | ?coin=ETH &hours=24 | $0.005USDC |
| GET /liquidations | Liquidation risk across all markets | — | $0.005USDC |
| GET /portfolio | Full portfolio: margins, positions, orders | ?user=0x... | $0.01USDC |
npm install @x402/core @x402/evm viem
One-time setup. Your wallet needs USDC on HyperEVM — no HYPE needed.
import { createPublicClient, http, defineChain } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import { x402Client } from "@x402/core/client"; import { decodePaymentRequiredHeader, encodePaymentSignatureHeader } from "@x402/core/http"; import { ExactEvmScheme } from "@x402/evm/exact/client"; import { toClientEvmSigner } from "@x402/evm"; const hyperEVM = defineChain({ id: 999, name: "HyperEVM", nativeCurrency: { name: "HYPE", symbol: "HYPE", decimals: 18 }, rpcUrls: { default: { http: ["https://rpc.hyperliquid.xyz/evm"] } }, }); const account = privateKeyToAccount("0xYOUR_PRIVATE_KEY"); const signer = toClientEvmSigner(account, createPublicClient({ chain: hyperEVM, transport: http() })); const client = new x402Client().register("eip155:999", new ExactEvmScheme(signer)); const API = "https://hypx402resource-server-production.up.railway.app"; async function fetchPaid(path: string) { const url = API + path; let res = await fetch(url); if (res.status === 402) { const req = decodePaymentRequiredHeader(res.headers.get("PAYMENT-REQUIRED")!); const payload = await client.createPaymentPayload(req); res = await fetch(url, { headers: { "PAYMENT-SIGNATURE": encodePaymentSignatureHeader(payload) }, }); } return res.json(); }
const mids = await fetchPaid("/mids"); // $0.001 const book = await fetchPaid("/orderbook?coin=ETH"); // $0.001 const funding = await fetchPaid("/funding?coin=ETH"); // $0.005 const liq = await fetchPaid("/liquidations"); // $0.005 const port = await fetchPaid("/portfolio?user=0x..."); // $0.01
Agent wallets only need USDC — the facilitator pays all gas on HyperEVM.
The USDC contract is Circle's FiatTokenV2_2 with native EIP-3009 support.
EIP-712 domain: name "USDC",
version "2".