CLI & MCP

The CLI is the path of least resistance. @aispace.bot/x402 is one package that runs as a CLI and an MCP server, and it carries the entire x402 payment step — no separate x402/viem install, no signing footguns.

Where Node is available, use the CLI. Raw HTTP is the fallback when you cannot run Node. MCP is for persistent hosted agents.

The three routes, in order

RouteSetupWhen to use it
1. CLI (npx) — defaultOne command; nothing to install. Set AISPACE_X402_KEY for paid calls.Almost every agent — anything that can shell out.
2. MCP server — complementaryOne-time mcp.json entry, then call tools.Cursor, Claude Desktop, persistent hosts.
3. Raw HTTP + x402/viem — fallbackSign EIP-3009 yourself.Only when you cannot run Node. See Quickstart.

Origin: https://x402.aispace.bot · built in Venice · pay AiSpace in USDC on Base.

Machine discovery: /llms.txt · /.well-known/x402.json · /openapi.json.

CLI (npx)

# free discovery
npx @aispace.bot/x402 models --type text
npx @aispace.bot/x402 openapi
npx @aispace.bot/x402 quote --kind video --body '{"model":"wan-2-7-text-to-video","duration":"5s","aspect_ratio":"16:9","resolution":"720p"}'
 
# paid
export AISPACE_X402_KEY=0x<base-wallet-private-key-funded-with-usdc>
npx @aispace.bot/x402 chat --model venice-uncensored --message "hi" --max-tokens 256
npx @aispace.bot/x402 call --path api/v1/image/generate --body '{"model":"...","prompt":"..."}'

Add --json where supported for raw responses. Paid commands run the full 402 → sign → retry loop.

MCP server

{
  "mcpServers": {
    "aispace-x402": {
      "command": "npx",
      "args": ["-y", "@aispace.bot/x402", "mcp"],
      "env": { "AISPACE_X402_KEY": "0x<base-wallet-private-key>" }
    }
  }
}
ToolPaid?Purpose
aispace_modelsfreelist models
aispace_openapifreeOpenAPI + info.x-pricing
aispace_quotefreeaudio/video { quote }
aispace_chatpaidchat completions (402 loop)
aispace_callvariesgeneric /api/v1/* call with 402 when needed

Environment

VariableRequired forDescription
AISPACE_X402_KEYpaid CLI / MCP toolsBase wallet private key with USDC. Env only — never a CLI flag. Key stays local.
AISPACE_X402_BASEoptionalOverride origin (default https://x402.aispace.bot).

When to use what

  • CLI — default. Scripts, cron, agent frameworks that shell out.
  • MCP — complementary. Hosted agents with tool calling.
  • Raw HTTP — fallback without Node. Quickstart · Auth and payment.

All three hit the same origin and the same Venice-equivalent × margin pricing. Live 402 amounts are authoritative; see Pricing.