BuyProxy logo
Log inSign up

CLI

BuyProxy command-line tool

The buyproxy command-line tool puts your whole BuyProxy account in the terminal. Generate residential, mobile, ISP and datacenter proxies in the format your tool wants, check what's left on every product, buy more by card or crypto, and run a reseller business β€” from a polished interactive interface when you're at the keyboard, or from scripts and CI with --json when you're not.

What it does

  • Generate rotating or sticky, geo-targeted proxies and print them as URLs, plain lines, JSON, shell exports, a curl command, or a ready Playwright / Python requests snippet β€” optionally straight to your clipboard.
  • Prove it works with buyproxy test: it routes a request through a fresh proxy and reports the exit IP, location, network and latency.
  • See your bandwidth per product with usage bars, and buy more without leaving the terminal β€” the CLI opens checkout and waits for the payment to land.
  • Run a reseller business: fund a pool, create customers, allocate GB, suspend and generate on their behalf.
  • Script anything β€” every command has a --json mode, stable exit codes and no prompts when piped.
  • Zero dependencies β€” a single self-contained build, so installs are fast and never break.

Install

Pick whichever is most convenient β€” they all give you the same buyproxy command. Node.js 18 or newer is required.

Homebrew (macOS & Linux)

bash
brew install DishantSinghDev2/tap/buyproxy

npm

bash
npm install -g buyproxy-cli

# or run it once without installing
npx buyproxy-cli

One-line installer

Uses npm if you have it, otherwise drops a single file into ~/.local/bin.

bash
curl -fsSL https://raw.githubusercontent.com/DishantSinghDev2/buyproxy-cli/main/install.sh | sh

# force the single-file install, or pin a version
curl -fsSL https://raw.githubusercontent.com/DishantSinghDev2/buyproxy-cli/main/install.sh | sh -s -- --standalone --version 1.0.0

Single file

Every GitHub release includes buyproxy.mjs β€” the whole CLI as one executable with a checksum. Download it, chmod +x, and put it on your PATH.

Check it worked:

bash
buyproxy --version
buyproxy help

First five minutes

  1. Create a key. In the dashboard open *API keys* and create one (no account yet? buyproxy signup creates one for you).
  2. Log in. buyproxy login β€” paste the key; it's checked, then saved privately.
  3. Look around. buyproxy balance shows what you have; buyproxy products shows what you can buy.
  4. Get bandwidth if you need it: buyproxy topup.
  5. Generate. buyproxy generate walks you through it, or buyproxy generate residential -c US -n 5 does it in one line.
  6. Prove it. buyproxy test shows the exit IP and latency.
bash
buyproxy login
buyproxy balance
buyproxy generate residential -c US -n 5
buyproxy test

Interactive mode

Run buyproxy with no arguments in a terminal for a guided experience: a gradient banner, a summary of your account, then a menu. If you aren't logged in yet it offers to log in, create an account, or open the dashboard.

KeyAction
↑ / ↓ or k / jMove
EnterChoose
q, Esc or Ctrl-CQuit / cancel β€” nothing is charged or changed

Personal keys see: Generate proxies Β· Bandwidth & plans Β· Buy bandwidth Β· Subscribe to a plan Β· Test a proxy Β· Payment history Β· Open dashboard Β· Account Β· Log out.

Reseller keys see a reseller menu instead: Customers Β· Reseller pool Β· Buy bandwidth into the pool, plus the shared items. The CLI detects your key type automatically.

After each action it waits for Enter before returning to the menu, so you can read the output. The interface adapts to narrow terminals, respects NO_COLOR, and falls back to plain output when it isn't running in a terminal.

All commands

Every command has its own page with options, a walkthrough, examples and troubleshooting.

Global options

These work on every command.

OptionWhat it does
--jsonMachine-readable output: no colour, no banners, no prompts. Errors still go to stderr with a non-zero exit code
--key <key>Use this API key for this one command, ignoring the saved key and the environment
--no-colorTurn colours off (also honours NO_COLOR; set FORCE_COLOR=1 to force them on)
-h, --helpHelp for the command; buyproxy help <command> also works
-v, --versionPrint the version

Configuration

The CLI finds your API key in this order β€” the first one wins:

  1. --key on the command line
  2. the BUYPROXY_API_KEY environment variable
  3. the saved config file, written by buyproxy login
SettingWhere
Saved key~/.config/buyproxy/config.json (or $XDG_CONFIG_HOME/buyproxy/config.json), permissions 0600
BUYPROXY_API_KEYAPI key for non-interactive use
BUYPROXY_BASE_URLPoint at a different API host (rarely needed)
NO_COLOR / FORCE_COLORDisable / force colour
BUYPROXY_DEBUG=1Print stack traces for unexpected errors

Personal (bp_key_…) and reseller (bp_live_…) keys are told apart automatically; buyproxy whoami shows which one is in use and where it came from.

Output modes

The CLI behaves differently depending on where its output is going, so it's pleasant interactively and clean in pipes:

  • In a terminal β€” colour, spinners, boxes, tables and usage bars. Progress messages go to *stderr*; results go to *stdout*.
  • Piped or redirected β€” plain data only. buyproxy generate -n 100 > proxies.txt writes just the proxies; no banner, no colour, no progress noise.
  • `--json` β€” a single JSON document on stdout, ideal for jq.

Commands that would prompt in a terminal (topup, subscribe, generate with several plans…) never prompt when piped β€” they take their answers from arguments and tell you exactly which one is missing.

Exit codes

CodeMeaning
0Success
1The API or the network returned an error (invalid key, no bandwidth, rate limit, server error)
2Usage error: unknown command or option, missing login, missing argument
130Cancelled by you (Ctrl-C / Esc)

Errors are written to stderr as a bold one-line message followed by a hint on how to fix it.

Shell completion

bash
# bash
buyproxy completion bash >> ~/.bashrc

# zsh (put the file on your fpath, then restart the shell)
buyproxy completion zsh > "${fpath[1]}/_buyproxy"

# fish
buyproxy completion fish > ~/.config/fish/completions/buyproxy.fish

CI & scripting

In automation, skip login and export the key as an environment variable (store it as a CI secret). Use --json and jq to read results, and rely on exit codes to fail a job.

GitHub Actions
- name: Install BuyProxy CLI
  run: npm install -g buyproxy-cli

- name: Fail the build if any product is nearly empty
  env:
    BUYPROXY_API_KEY: ${{ secrets.BUYPROXY_API_KEY }}
  run: |
    low=$(buyproxy balance --json | jq '[.balances[] | select(.activeGb < 1 and .planId != null)] | length')
    test "$low" -eq 0 || { echo "::error::Low on proxy bandwidth"; exit 1; }

More end-to-end recipes are in Guides & recipes. Prefer a library to shelling out? Use an SDK.

Security

  • The saved key is stored in your home directory with 0600 permissions β€” readable only by your user. buyproxy logout deletes it; it doesn't revoke the key β€” do that in the dashboard if it was exposed.
  • The CLI only ever talks to www.buyproxy.org (and, for buyproxy test, asks ipinfo.io for your exit IP *through* the proxy). It sends no analytics.
  • On shared machines or in logs, prefer the environment variable over --key: command-line arguments can appear in process lists and shell history.
  • Generated proxy credentials are secrets too β€” avoid pasting full proxy lines into tickets or chats.

Update & uninstall

bash
# update
brew upgrade buyproxy            # Homebrew
npm update -g buyproxy-cli       # npm

# uninstall
brew uninstall buyproxy
npm uninstall -g buyproxy-cli
rm -f ~/.local/bin/buyproxy      # single-file install
rm -rf ~/.config/buyproxy        # saved key

Troubleshooting

You seeWhat it meansFix
You're not logged in.No key found in the flag, environment or configbuyproxy login or export BUYPROXY_API_KEY
Invalid BuyProxy API keyThe key is wrong, revoked or incompleteCreate a new key in the dashboard
This needs a reseller API key (bp_live_…)You used a personal key on a reseller commandCreate a reseller key (Business plan or higher)
You don't have any bandwidth yet.No plan on any productbuyproxy topup
Rate limit exceededMore than 60 requests/minute on one keyWait, or batch with -n instead of looping
This account has been suspended.The account behind the key is suspendedContact support
command not found: buyproxyThe install directory isn't on your PATHAdd ~/.local/bin (or npm's global bin) to PATH
Garbled boxes or coloursTerminal lacks UTF-8 or truecolorUse a UTF-8 locale, or --no-color
Nothing opens for paymentNo browser available (SSH, container)Use --no-open and open the printed link elsewhere

Still stuck? Run the command with BUYPROXY_DEBUG=1 and contact support with the output (remove any keys first).

Was this page helpful?