For agents / CLI referenceDocs menu

CLI reference

The official command-line client. Handles auth, MCP setup, payment signing, and more.

Install

bash
# global install
npm install -g @apihubio/cli

# or run on demand
npx @apihubio/cli <command>

The CLI stores config (API key, preferences) in ~/.apihub/config.json.

apihub register

Open the dashboard, sign in via magic link, paste the resulting key. Saves to local config so subsequent commands work without flags.

bash
apihub register

apihub balance

Show current credit balance with a low-balance warning if you're below threshold.

bash
apihub balance

apihub topup <amount>

Open USDC payment UI in your browser. Minimum $5.

bash
apihub topup 10
apihub topup 25
apihub topup 100

Search the external x402 marketplace and the onboarded catalog. Returns matching services with price and description.

bash
apihub search "weather"
apihub search "translation" --category ai
apihub search --limit 20

Categories: ai, search, finance, media, other. Limit defaults to 10.

apihub call <url>

Make a paid call to any x402 endpoint. CLI handles credit deduction (or x402 signing if your wallet is configured) and prints the response.

bash
# GET request
apihub call https://bitcoinsapi.com/api/v1/fees/landscape

# POST with JSON body
apihub call https://example.com/api/translate \
  -X POST \
  -d '{ "text": "hello", "target": "es" }' \
  --json

# add custom headers
apihub call https://example.com/api \
  -H "X-Custom: value"

Flags: -X method (default GET), -d body, -H header (repeatable), --json auto-set Content-Type to application/json.

apihub add <url>

Verify an x402 endpoint is reachable and add it to your local toolset. Useful for building scripts that call several APIs.

bash
apihub add https://api.example.com/v1/translate

apihub install

Configure APIHub MCP for your detected AI clients. Writes the config snippet (URL + Authorization header) to the right file for each.

bash
# install for all detected clients
apihub install

# or target one
apihub install --target claude
apihub install --target cursor
apihub install --target codex
apihub install --target claude-code

Detects: Claude Desktop, Cursor, OpenAI Codex CLI, Claude Code. Edits the relevant config file in place. Re-run to update credentials.

apihub init

Scaffold a starter project for one of the supported templates.

bash
# scaffold into the current directory
apihub init --template python

# or a specific subdirectory
apihub init my-bot --template node-ts

Templates: claude, openai, langchain, python, node-ts. Generates a minimal example that uses APIHub credits to call a paid API.

Help anywhere

Run apihub --help or apihub <command> --help for the latest flags. The CLI is at version 0.3.x and ships frequent updates.