This file is read by the agent at session start. It defines how to use ampersend x402 payment capabilities safely inside Hermes.
- When the user needs paid HTTP APIs (x402 / HTTP 402 flows) or autonomous stablecoin payments within limits, use the
ampersendCLI from the agent's terminal. - Base mainnet and the production ampersend API (
https://api.ampersend.ai) are the defaults. Do not change these unless the user explicitly asks.
getApiClient() from this package exposes only authorizePayment, reportPaymentEvent, and auth helpers — it does not expose .fetch. (The raw SDK ApiClient has an internal HTTP helper for ampersend API paths only; calling it with a full https://… URL was a common mistake and is blocked here.)
Correct ways to hit an x402-paid URL:
- CLI (preferred):
ampersend fetch <url>orampersend fetch --inspect <url>(no charge). - From this package:
getPaidFetch()from@ampersend/hermes— it usescreateAmpersendHttpClient+wrapFetchWithPayment(same as the CLI).
Example (after pnpm build, with .env loaded):
npx tsx -e "import { getPaidFetch } from './dist/client.js'; const f = getPaidFetch(); f('https://example.com/paid').then(r => r.text()).then(console.log).catch(console.error)"Always check payment requirements before authorizing a payment:
- Use
ampersend fetch --inspect <url>to see what a paid endpoint costs before paying. - Tell the user what the payment will cost in plain language before proceeding.
- Only authorize payment after the user confirms, unless they have explicitly granted standing permission to pay within their configured spend limits.
- NEVER ask the user to sign in to the ampersend dashboard in a browser you control. If dashboard or policy changes are required, tell them to do it on their device/browser.
- NEVER log, echo, or display private keys or session keys (
AMPERSEND_AGENT_KEY). If the user asks you to show their key, decline and explain why. - NEVER modify spend limits programmatically without explicit user consent.
- Treat payment authorization as irreversible — once a payment is sent, it cannot be undone.
- CLI commands return JSON. Check
okfirst — treat the call as successful only whenokistrue. - On failure, surface
error.codeanderror.messageto the user. Do not silently swallow payment errors.
- Do not exfiltrate private data (keys, account addresses, payment history).
- Do not run destructive commands without explicit consent.
- Confirm before any payment above the user's configured per-transaction limit.
- When in doubt, ask before actions that spend funds.
If BOOTSTRAP.md exists in this directory, follow it step by step, then delete it when finished.
- Check if ampersend is configured:
ampersend config status - If not configured, follow
BOOTSTRAP.mdor prompt the user to runpnpm setup - Verify the CLI is working:
ampersend fetch --inspect <any-url>
Add project-specific conventions, frequently-used paid endpoints, and spend policy notes below as this workspace evolves.