agstell-cli
v0.2.1
Published
CLI for AgentMarket — discover and call APIs with x402 micropayments on Stellar
Maintainers
Readme
AgentMarket CLI
Command-line interface for interacting with the AgentMarket API marketplace using x402 micropayments on Stellar.
Installation
npm install -g agentmarket-cliOr use directly with npx:
npx agentmarket-cliQuick Start
# Initialize with your Stellar wallet
agentmarket init
# Or generate a new testnet keypair
agentmarket init --generate
# Fund your testnet account
agentmarket fund
# Check your balance
agentmarket balance
# List available APIs
agentmarket list
# Call an API (auto-pays with USDC)
agentmarket call weather --city "San Francisco"Commands
init
Initialize the CLI with your Stellar wallet.
# Interactive mode
agentmarket init
# With secret key
agentmarket init --key SXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
# Generate new keypair
agentmarket init --generate
# Use mainnet (default is testnet)
agentmarket init --network mainnetfund
Fund your testnet account using Stellar Friendbot (testnet only).
agentmarket fundbalance
Check your wallet balance.
agentmarket balance
# or
agentmarket balOutput:
Balance retrieved
Network: testnet
Address: GXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XLM: 10000.0000000 XLM
USDC: 100.0000000 USDClist
List available APIs.
# List all APIs
agentmarket list
# Filter by category
agentmarket list --category Data
agentmarket list -c AICategories: Data, Finance, Geo, AI
call
Call an API with automatic x402 payment.
# Weather
agentmarket call weather --city "Tokyo"
# Air Quality
agentmarket call air-quality --city "Delhi"
# News
agentmarket call news --topic "cryptocurrency"
# Currency conversion
agentmarket call currency --from USD --to EUR --amount 100
# Geolocation
agentmarket call geolocation --ip "8.8.8.8"
# AI inference
agentmarket call ai --prompt "Explain blockchain in simple terms"
# Custom params (JSON)
agentmarket call weather -p '{"city": "London", "units": "metric"}'
# Dry run (no payment)
agentmarket call weather --city "Paris" --dry-runinfo
Get detailed information about an API.
agentmarket info weatherhistory
View your call history.
# Last 20 calls
agentmarket history
# Last 50 calls
agentmarket history --limit 50config
View or update configuration.
# Show config
agentmarket config --show
# Update settings
agentmarket config --network mainnet
agentmarket config --budget 50
agentmarket config --marketplace https://api.agentmarket.xyzHow It Works
- Request: When you call an API, the CLI first sends a request
- 402 Response: The server responds with HTTP 402 and payment details
- Payment: CLI automatically sends USDC via Stellar
- Data: CLI retries the request with payment proof and returns data
All of this happens automatically - you just make the call!
Configuration
Config is stored in ~/.agentmarket/config.json:
{
"stellarNetwork": "testnet",
"secretKey": "SXXXXX...",
"publicKey": "GXXXXX...",
"marketplaceUrl": "https://agentmarket.xyz",
"budgetLimit": 10
}Call history is stored in ~/.agentmarket/history.json.
Pricing
| API | Price per call | |-----|---------------| | Weather | $0.001 USDC | | Air Quality | $0.001 USDC | | News | $0.002 USDC | | Currency | $0.001 USDC | | Geolocation | $0.001 USDC | | AI Inference | $0.005 USDC |
Environment Variables
You can also configure via environment variables:
export AGENTMARKET_SECRET_KEY=SXXXXX...
export AGENTMARKET_NETWORK=testnet
export AGENTMARKET_URL=https://agentmarket.xyzDevelopment
# Clone
git clone https://github.com/agentmarket/cli.git
cd cli
# Install deps
npm install
# Build
npm run build
# Run locally
node dist/cli.js
# Development mode (watch)
npm run devLicense
MIT
