For developers

One call to stop paying from a sleeping wallet.

Wrap the fetch your agent already makes. When a server answers 402, the SDK checks your spending policy, settles from the buffer and retries with the payment attached. Published on npm and PyPI under the MIT license.

TypeScriptnpm install @unslept/sdk viem
Pythonpip install "unslept[web3]"
MCPnpx -y @unslept/mcp

Live Try a real paid endpoint

The demo endpoint asks for 0.01 USDG on mainnet and answers with live protocol stats once the payment settles.

GET https://www.unslept.xyz/api/demo/x402How x402 works with Unslept
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),
  network: "robinhood-chain",
});

// A drop-in fetch. On 402 it checks the policy, settles, and retries.
const res = await unslept.fetch("https://api.example.com/data", undefined, {
  maxAmount: 50_000n, // 0.05 USDG, never more for this call
});
agent.py
import os
from eth_account import Account
from unslept import Unslept
from unslept.web3_chain import EthAccountSigner

unslept = Unslept(
    agent_account=os.environ["UNSLEPT_AGENT_ACCOUNT"],
    signer=EthAccountSigner(Account.from_key(os.environ["UNSLEPT_SIGNER_KEY"])),
    network="robinhood-chain",
)

res = unslept.fetch("https://api.example.com/data")
print(res.status, res.text())
mcp.json
{
  "mcpServers": {
    "unslept": {
      "command": "npx",
      "args": ["-y", "@unslept/mcp"],
      "env": {
        "UNSLEPT_AGENT_ACCOUNT": "<your agent account address>",
        "UNSLEPT_SIGNER_KEY": "<agent signer key, from your secret store>",
        "UNSLEPT_NETWORK": "robinhood-chain"
      }
    }
  }
}

Put idle agent money to work.

Create an agent account in a few minutes, or supply the liquidity that settles payments.