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
requestssnippet β 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
--jsonmode, 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)
brew install DishantSinghDev2/tap/buyproxynpm
npm install -g buyproxy-cli
# or run it once without installing
npx buyproxy-cliOne-line installer
Uses npm if you have it, otherwise drops a single file into ~/.local/bin.
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.0Single 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:
buyproxy --version
buyproxy helpFirst five minutes
- Create a key. In the dashboard open *API keys* and create one (no account yet?
buyproxy signupcreates one for you). - Log in.
buyproxy loginβ paste the key; it's checked, then saved privately. - Look around.
buyproxy balanceshows what you have;buyproxy productsshows what you can buy. - Get bandwidth if you need it:
buyproxy topup. - Generate.
buyproxy generatewalks you through it, orbuyproxy generate residential -c US -n 5does it in one line. - Prove it.
buyproxy testshows the exit IP and latency.
buyproxy login
buyproxy balance
buyproxy generate residential -c US -n 5
buyproxy testInteractive 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.
| Key | Action |
|---|---|
β / β or k / j | Move |
Enter | Choose |
q, Esc or Ctrl-C | Quit / 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.
Proxies
Billing
Account
Reseller
Tools
Global options
These work on every command.
| Option | What it does |
|---|---|
--json | Machine-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-color | Turn colours off (also honours NO_COLOR; set FORCE_COLOR=1 to force them on) |
-h, --help | Help for the command; buyproxy help <command> also works |
-v, --version | Print the version |
Configuration
The CLI finds your API key in this order β the first one wins:
--keyon the command line- the
BUYPROXY_API_KEYenvironment variable - the saved config file, written by
buyproxy login
| Setting | Where |
|---|---|
| Saved key | ~/.config/buyproxy/config.json (or $XDG_CONFIG_HOME/buyproxy/config.json), permissions 0600 |
BUYPROXY_API_KEY | API key for non-interactive use |
BUYPROXY_BASE_URL | Point at a different API host (rarely needed) |
NO_COLOR / FORCE_COLOR | Disable / force colour |
BUYPROXY_DEBUG=1 | Print 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.txtwrites 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
| Code | Meaning |
|---|---|
0 | Success |
1 | The API or the network returned an error (invalid key, no bandwidth, rate limit, server error) |
2 | Usage error: unknown command or option, missing login, missing argument |
130 | Cancelled 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
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.fishCI & 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.
- 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
0600permissions β readable only by your user.buyproxy logoutdeletes 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, forbuyproxy test, asksipinfo.iofor 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
# 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 keyTroubleshooting
| You see | What it means | Fix |
|---|---|---|
You're not logged in. | No key found in the flag, environment or config | buyproxy login or export BUYPROXY_API_KEY |
Invalid BuyProxy API key | The key is wrong, revoked or incomplete | Create a new key in the dashboard |
This needs a reseller API key (bp_live_β¦) | You used a personal key on a reseller command | Create a reseller key (Business plan or higher) |
You don't have any bandwidth yet. | No plan on any product | buyproxy topup |
Rate limit exceeded | More than 60 requests/minute on one key | Wait, or batch with -n instead of looping |
This account has been suspended. | The account behind the key is suspended | Contact support |
command not found: buyproxy | The install directory isn't on your PATH | Add ~/.local/bin (or npm's global bin) to PATH |
| Garbled boxes or colours | Terminal lacks UTF-8 or truecolor | Use a UTF-8 locale, or --no-color |
| Nothing opens for payment | No 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?