CLI reference
The official command-line client. Handles auth, MCP setup, payment signing, and more.
Install
# 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.
apihub registerapihub balance
Show current credit balance with a low-balance warning if you're below threshold.
apihub balanceapihub topup <amount>
Open USDC payment UI in your browser. Minimum $5.
apihub topup 10
apihub topup 25
apihub topup 100apihub search
Searches both APIHub's catalog of onboarded APIs and the external x402 marketplace, and lists the matches from each with price and description. No API key needed. Catalog results link to their marketplace page, which lists the endpoints you can call with apihub call.
apihub search "weather"
apihub search "walmart" --catalog # APIHub catalog only
apihub search "translation" --external # external x402 APIs only
apihub search --category finance --limit 20Requires CLI 0.4.0 or later (older versions search external APIs only). Limit applies to each list and 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.
# 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.
apihub add https://api.example.com/v1/translateapihub install
Configure APIHub MCP for your detected AI clients. Writes the config snippet (URL + Authorization header) to the right file for each.
# 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-codeDetects: 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.
# scaffold into the current directory
apihub init --template python
# or a specific subdirectory
apihub init my-bot --template node-tsTemplates: claude, openai, langchain, python, node-ts. Generates a minimal example that uses APIHub credits to call a paid API.
Help anywhere
apihub --help or apihub <command> --help for the latest flags. The CLI is at version 0.3.x and ships frequent updates.