Skip to content

feat(sdk): add ampersend CLI for x402 HTTP requests#55

Open
matiasedgeandnode wants to merge 8 commits intomainfrom
ASND-170/asndurl-openclaw-skill
Open

feat(sdk): add ampersend CLI for x402 HTTP requests#55
matiasedgeandnode wants to merge 8 commits intomainfrom
ASND-170/asndurl-openclaw-skill

Conversation

@matiasedgeandnode
Copy link
Collaborator

@matiasedgeandnode matiasedgeandnode commented Mar 4, 2026

Summary

  • Add ampersend fetch command - a curl-like CLI for making HTTP requests to x402 payment-gated APIs with automatic payment handling
  • Add ampersend config commands for managing smart account configuration (init, set-agent, status, set-api, clear-api)
  • Add OpenClaw skill definition for agent integration

Test plan

  • Run pnpm build to verify TypeScript compiles
  • Run pnpm test to verify existing tests pass
  • Test ampersend config init creates config with session key
  • Test ampersend config set-agent <address> completes setup
  • Test ampersend config status shows correct state
  • Test ampersend fetch --inspect <url> shows payment requirements without paying
  • Test ampersend fetch <url> makes request with automatic payment
  • Test --raw, --headers, and --debug flags work correctly
  • Verify env var configuration (AMPERSEND_AGENT_KEY) takes precedence over file config

Generated with Claude Code

@matiasedgeandnode matiasedgeandnode force-pushed the ASND-170/asndurl-openclaw-skill branch 6 times, most recently from 6063043 to 005dd4b Compare March 6, 2026 19:30
@matiasedgeandnode matiasedgeandnode force-pushed the ASND-170/asndurl-openclaw-skill branch 2 times, most recently from c2b9b23 to 8970ab9 Compare March 11, 2026 12:54
Add a curl-like CLI tool for making HTTP requests to x402 payment-gated
APIs. Designed for agent use with structured JSON output.

- Automatic 402 handling with Ampersend smart account payments
- JSON envelope output with ok/error discrimination
- --inspect mode to preview payment requirements without paying
- --raw mode for human-readable output
- --headers and --debug flags for troubleshooting
- OpenClaw skill definition for agent integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@matiasedgeandnode matiasedgeandnode force-pushed the ASND-170/asndurl-openclaw-skill branch from 8970ab9 to dad5003 Compare March 11, 2026 19:13
@matiasedgeandnode matiasedgeandnode changed the title feat(sdk): add asndurl CLI for x402 HTTP requests feat(sdk): add ampersend CLI for x402 HTTP requests Mar 11, 2026
@matiasedgeandnode matiasedgeandnode marked this pull request as ready for review March 11, 2026 19:17
matiasedgeandnode and others added 3 commits March 11, 2026 17:12
- Extract shared JSON envelope types to envelope.ts to eliminate
duplication between fetch.ts and config.ts
- Standardize error format: all errors now use {code, message} structure
instead of allowing plain strings
- Use viem's isAddress() for proper Ethereum address validation
- Hardcode VERSION constant instead of runtime package.json read
- Remove --debug flag and debug.ts (350 lines) - will revisit later
- Add tests for envelope and config modules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@matiasedgeandnode matiasedgeandnode force-pushed the ASND-170/asndurl-openclaw-skill branch from f6e92e0 to 78eca8d Compare March 13, 2026 14:21

```bash
ampersend config init
# {"ok": true, "data": {"sessionKeyAddress": "0x...", "status": "pending_agent"}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's not call it sessionKeyAddress, maybe agentKeyAddress?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes working on a global renaming. Will end up having:

  • agentKeyAddress
  • agentKey
  • agentAccount
  • agentSecret

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice! I wonder if it'd be good to have a note in the skill.md briefly explaining what these are and which are relevant or irrelevant for the user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about we do something like:

Human-readable identifier for agent configurations, replacing long hex addresses with memorable word combinations like brave-tiger-sunset.

How it works:
- SHA256 hash of {agent_key_address}:{agent_account} (both lowercase)
- First 32 bits map to 3 words from BIP39 word list (2048 curated words)
- Deterministic: same inputs → same name on both CLI and platform

Why:
- Users can visually verify their agent matches across CLI and dashboard
- Memorable enough to recognize ("is this my agent?")
- ~1 billion combinations—sufficient uniqueness for practical use

Example:
0xABC...123 + 0xDEF...456 → "brave-tiger-sunset"

And then we can start surfacing this identifier (maybe call it config-name or similar) both in the CLI and in the UI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, for now I've added a simple configName to be surfaced everywhere. Will move to full human-readable implementation in a future PR.

npm install -g @ampersend_ai/ampersend-sdk
```

If not configured, commands return setup instructions. To configure:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a short explanation of what this does would be useful. What does config init actually do? What does it mean to register the key in the dashboard?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather wait until the agent lead onboarding is out and then clean this up. Init is pretty useless at this point for an agent, can't do much about it. Because in fact the dashboard doesn't allow to add an arbitrary key to an agent.


# Ampersend CLI

CLI for Ampersend smart account wallets. Enables agents to make payments.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more information about ampersend would be useful, so that an agent reading this can explain to the human what makes ampersend an interesting way to enable payments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also suggest adding something like:

## Security

NEVER ask the user to sign in to the ampersend dashboard in a browser to which you have access. If you need changes in the ampersend configuration, ask your user to do them.

(eventually we'll show how to request changes, etc, but for now I think this is the main thing we wanna ensure)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added some version of this, but would rather refine the SKILL.md in subsequent PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants