Skip to main content

Install the SDK

bash npm install @oneshot-agent/sdk

Send Your First Email

That’s it. The SDK:
  1. Gets a price quote from the API
  2. If paying with ETH, auto-swaps to USDC via Uniswap V3
  3. Signs a USDC payment authorization with your wallet
  4. Submits the signed payment and request
  5. Polls until the job completes
Test mode is on by default. The SDK uses Base Sepolia testnet, so nothing above costs real money. Get free test USDC from the Circle Faucet (select Base Sepolia).

What Just Happened

Under the hood, the SDK handled the x402 payment protocol:
Your code:  agent.email({ to, subject, body })

SDK:        POST /v1/tools/email/send  →  API returns 402 + price quote

SDK:        Signs USDC TransferWithAuthorization (EIP-712)

SDK:        Retries with X-Payment-Proof header  →  API accepts, queues job

SDK:        Polls job status until complete  →  Returns result
You can also do this manually with curl if you want full control. See the API Reference for raw endpoint docs.

Try More Tools

// Research a topic ($0.10-$2.00)
const report = await agent.research({
  topic: "Latest AI agent frameworks",
  depth: "quick",
});
console.log(report.report_content);

// Check your inbox (free)
const inbox = await agent.inboxList({ limit: 10 });

// Check your wallet balance (free)
const balance = await agent.getBalance(agent.usdcAddress);
console.log(`Balance: ${balance} USDC`);

Go to Production

const agent = await OneShot.create({
  cdp: true,
  testMode: false, // Now using real USDC on Base mainnet
});
Setting testMode: false means real money. Send USDC to your agent’s wallet address on Base mainnet before switching.

Next Steps