@mrgoonie/rapidapi-cli
v0.2.0
Published
CLI proxy for RapidAPI.com — agent & human friendly
Downloads
435
Maintainers
Readme
@mrgoonie/rapidapi-cli
CLI proxy for RapidAPI.com — designed for both humans and AI agents.
What it does
- Proxies HTTP requests through RapidAPI with automatic auth headers injected.
- Provides
--jsonoutput on every command for machine-readable piping. - Exposes
--manifestfor self-discovery by AI agents. - Supports RapidAPI Enterprise Hub GraphQL search.
Install
Recommended (any machine with Node ≥ 20)
npm install -g @mrgoonie/rapidapi-cliWith Bun
bun install -g @mrgoonie/rapidapi-cliOne-shot (no install)
npx @mrgoonie/rapidapi-cli --manifestQuickstart
# 1. Save your key
rapidapi login --key $RAPIDAPI_KEY
# 2. Make your first call
rapidapi call twitter154.p.rapidapi.com /user/details \
--query username=elonmusk \
--query user_id=44196397
# 3. Get JSON output for scripting / agents
rapidapi call twitter154.p.rapidapi.com /user/details \
--query username=elonmusk \
--json | jq .result.legacy.nameCommands
rapidapi call <host> <path>
Proxy an HTTP request through RapidAPI.
Options:
--method <method> HTTP method (default: GET)
--header <k=v> Extra headers (repeatable)
--query <k=v> Query params (repeatable)
--data <body> Request body: JSON string, @file, or - for stdin
--key <key> RapidAPI key (overrides env/config)
--timeout <ms> Request timeout in ms (default: 30000)
--raw Print raw response bodyUnknown flags become query params automatically:
rapidapi call twitter154.p.rapidapi.com /user/details \
--username elonmusk --user_id 44196397POST with JSON body:
rapidapi call api.example.p.rapidapi.com /items \
--method POST \
--data '{"name":"widget"}' \
--header Content-Type=application/jsonBody from file:
rapidapi call api.example.p.rapidapi.com /items \
--method POST --data @payload.jsonBody from stdin:
cat payload.json | rapidapi call api.example.p.rapidapi.com /items \
--method POST --data -rapidapi search <query>
Search for APIs on RapidAPI Enterprise Hub (requires searchEndpoint).
Options:
--category <name> Filter by category
--tag <tag> Filter by tag
--limit <n> Results per page (default: 10)
--cursor <cursor> Pagination cursor from previous page
--key <key> RapidAPI key overriderapidapi search "twitter" --limit 5 --json
rapidapi search "weather" --category "Data" --jsonSee docs/search-setup.md for Enterprise Hub configuration.
rapidapi login
Save your RapidAPI key to local config.
rapidapi login # interactive prompt (hidden input)
rapidapi login --key $KEY # non-interactiverapidapi config
Manage CLI configuration.
rapidapi config list # show all values
rapidapi config get apiKey # get one value
rapidapi config set apiKey <value> # persist a value
rapidapi config set searchEndpoint <url> # set Enterprise search URL
rapidapi config unset apiKey # remove a value
rapidapi config path # show config file locationrapidapi --manifest
Print a machine-readable JSON description of all commands and flags. Intended for AI agent self-discovery.
rapidapi --manifest | jq .commands[].nameConfiguration & env var precedence
Values are resolved in this order (highest → lowest priority):
| Priority | Source |
|----------|--------|
| 1 | CLI flag (--key, --timeout, …) |
| 2 | Environment variable |
| 3 | Config file (rapidapi config set …) |
| 4 | Built-in default |
Supported environment variables
| Variable | Config key | Description |
|----------|------------|-------------|
| RAPIDAPI_KEY | apiKey | Your RapidAPI subscription key |
| RAPIDAPI_SEARCH_ENDPOINT | searchEndpoint | Enterprise Hub GraphQL URL |
| RAPIDAPI_DEFAULT_HOST | defaultHost | Default API host (optional shorthand) |
| RAPIDAPI_IDENTITY_KEY | identityKey | Team identity key for Enterprise accounts |
Copy .env.example and fill in your values:
cp .env.example .envFor AI agents
See docs/agent-guide.md for:
- How to use
--manifestfor self-discovery - Stable
--jsonerror schema - Exit codes
- Deprecation policy
Quick pattern:
# 1. Discover commands
rapidapi --manifest
# 2. Call with structured output
rapidapi call <host> <path> [flags] --json
# 3. Parse errors
rapidapi call bad.host /path --json 2>&1 | jq .errorLimitations
- Requires a RapidAPI account and a subscribed API.
searchrequires RapidAPI Enterprise Hub (not available on free tier).--provenanceon npm publish requires GitHub Actions OIDC (configured in CI).
Contributing
See CONTRIBUTING.md.
License
MIT — see LICENSE.
