Get started

Quickstart

From an empty wallet to an agent that pays its first x402 request, in five steps.

This guide uses the app for everything that involves your own wallet, and the SDK for the agent. Plan for about ten minutes. You need a wallet on Robinhood Chain with a little ETH for gas and some USDG for the agent to spend.

  1. Connect your wallet

    Open the app and connect a browser wallet. If it is on another network, the app offers to switch to Robinhood Chain. This wallet becomes the owner of your agent accounts: it sets policies, funds agents and can always withdraw.

  2. Create an agent account

    On the Agents page, create an account. You choose:

    • Signer: the address of the key your agent runs with. Generate a fresh key for each agent and keep it apart from your own wallet. The signer can only request payments within the policy; it can never withdraw.
    • Per-call cap: the most a single payment may cost.
    • Daily cap: the most the agent may spend in one UTC day.
  3. Allowlist who it may pay

    Add the payee addresses (or API host names) your agent is allowed to pay. Until you add one, the agent cannot pay anyone. Addresses are enforced strictly on chain; host names rely on what the SDK reports, so prefer addresses where you can.

  4. Fund the account

    Deposit USDG into the account from the agent's card. A keeper parks the idle part in spUSDG automatically. You can turn that off per account, and you can unwind and withdraw at any time.

  5. Point your agent at a paid API

    Install the SDK, copy the environment from the Developers page and swap your fetch for unslept.fetch.

    terminal
    npm install @unslept/sdk viem
    agent.ts
    import { Unslept } from "@unslept/sdk";
    import { privateKeyToAccount } from "viem/accounts";
    
    const unslept = new Unslept({
      agentAccount: process.env.UNSLEPT_AGENT_ACCOUNT,
      signer: privateKeyToAccount(process.env.UNSLEPT_SIGNER_KEY as `0x${string}`),
      network: "robinhood-chain",
    });
    
    const res = await unslept.fetch("https://www.unslept.xyz/api/demo/x402");
    console.log(res.status, await res.json());

The URL above is the live demo endpoint. It costs 0.01 USDG and answers with current protocol stats once the payment settles, so it is an easy way to confirm everything works end to end.