agnic
v2.0.0
Published
CLI for AgnicPay - AI agent wallet for x402 payments and token trading
Downloads
311
Maintainers
Readme
agnic
CLI for AgnicPay — AI agent wallet for x402 payments and token trading.
Install
npm install -g agnicOr run directly:
npx agnic --helpQuick Start
# Login with email
agnic auth login [email protected]
agnic auth verify <flowId> <code>
# Check balance
agnic balance
# Send USDC
agnic send 5.00 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7
# Trade tokens on Base
agnic trade 10 usdc eth
# Search x402 APIs
agnic x402 search "sentiment analysis"
# Pay for an x402 API
agnic x402 pay https://api.example.com/dataAuthentication
Three methods (in priority order):
| Method | Example |
|--------|---------|
| --token flag | agnic balance --token agnic_tok_sk_live_... |
| AGNIC_TOKEN env var | export AGNIC_TOKEN=agnic_tok_sk_live_... |
| Stored token | agnic auth login [email protected] |
Tokens are stored at ~/.agnic/config.json with 0600 permissions.
Commands
| Command | Description |
|---------|-------------|
| agnic auth login <email> | Login with email OTP |
| agnic auth verify <flowId> <otp> | Verify OTP code |
| agnic auth logout | Remove stored credentials |
| agnic status | Check auth and wallet status |
| agnic balance | Check USDC balance |
| agnic address | Show wallet address |
| agnic send <amount> <to> | Send USDC |
| agnic trade <amount> <from> <to> | Swap tokens on Base |
| agnic x402 search <query> | Search x402-enabled APIs |
| agnic x402 pay <url> | Make an x402 payment request |
All commands support --json for machine-readable output.
Trade Options
agnic trade 10 usdc eth # Execute swap
agnic trade 10 usdc eth --dry-run # Preview quote only
agnic trade 10 usdc eth --slippage 0.5 # Custom slippageSupported tokens: USDC, ETH, WETH, cbETH, DAI, AERO (Base mainnet).
x402 Options
agnic x402 search "weather" --category Data --limit 5
agnic x402 pay https://api.example.com/data --method POST --body '{"query":"test"}'Example: Agent Script
#!/bin/bash
BALANCE=$(agnic balance --network base --json | jq -r '.[0].balance')
echo "Balance: $BALANCE USDC"
agnic trade 5 usdc eth --json
agnic x402 pay https://api.example.com/analysis --jsonDocumentation
Full docs at docs.agnic.ai/docs/agnicpay-features/cli
License
MIT
