---
name: virginproxy
description: Fetch live web pages with the VirginProxy CLI (`vp`) – a page as clean Markdown, structured product/article/job data, screenshots, PDFs, all URLs of a site, crawls and web search with the result pages included. Use whenever a task needs current content from the web that a plain fetch cannot get (pages that block bots, need JavaScript, or must be read as Markdown for an LLM), when the user mentions VirginProxy, scraping, crawling, a sitemap, a screenshot of a site, or asks to search the web and read the results.
---

# VirginProxy CLI (`vp`)

`vp` calls the VirginProxy web scraping API. Check it is available with `vp --version`; if not, it can be
downloaded from https://docs.virginproxy.com/cli/vp.mjs (Node.js 18+, no dependencies).

## Keys – never in the chat

- The key comes from `VP_API_KEY` or from the file written by `vp login` (`~/.config/virginproxy/key`).
- Check with `vp whoami` (prints the key masked). If no key is set, ask the user to run `vp login` **themselves**
  in their terminal. Never ask the user to paste a key into the conversation, never put a key on a command line,
  in a file you write, or in your output.
- `vp_test_…` keys return sample answers at no cost – good for trying commands.

## Commands

Always add `--json` when you parse the output. Errors then arrive as `{"error": {"code", "message"}}`;
exit code 1 = API error, 2 = wrong usage or no key.

| Need | Command |
| --- | --- |
| A page as Markdown (main content) | `vp scrape <url>` |
| A page that needs JavaScript or blocks plain requests | `vp scrape <url> --render-auto` (browser only if needed) or `--render` (always) |
| Structured data | `vp scrape <url> --auto-extract product\|article\|job\|review_list\|recipe\|event\|organization --json` |
| Own fields by CSS | `vp scrape <url> --extract '{"title":"h1","price":".price"}' --json` |
| Only part of a page | `--include-selector "main article"` / `--exclude-selector "nav, footer, .ads"` |
| Remove personal data | `--redact email,phone` (or `all`) |
| PDF / Office document as text | `vp scrape <url-to-file.pdf> --format markdown --max-pages 30` |
| Screenshot | `vp screenshot <url> -o page.png [--full-page]` – then view the file |
| PDF of a page | `vp pdf <url> -o page.pdf` |
| All URLs of a site | `vp map <url> [--search blog] [--limit 500]` |
| Many pages of a site | `vp crawl <url> --limit 30 [--include-path "/docs/**"] --wait --json` (NDJSON, one page per line) |
| Web search | `vp search "<query>" --limit 5 --json`; add `--scrape` to get each result page as Markdown |
| Background jobs | `vp jobs list`, `vp jobs get <id> --wait 25`, `vp jobs results <id> --all --json`, `vp jobs cancel <id>` |
| Anything else | `vp request '{"url": "...", ...}'` with any option of `POST /v1/requests` |
| Credits left | `vp usage` |

Run `vp <command> --help` for every option.

## Cost hints

- A plain page is about 1 credit per MB. `--render` adds 9 credits; `--render-auto` tries without a browser
  first and charges only the answer delivered – prefer it over `--render` when unsure.
- Screenshots and PDFs: 10 credits. `search`: about 1 credit per results page with DuckDuckGo (the default), plus one per fetched result with `--scrape`.
- Crawls charge every page: always set `--limit` (start small, e.g. 10–30) and consider `--max-credits`.
- Put `--max-credits <n>` on anything that could get expensive. Check `vp usage` before large jobs.
- Prefer `vp map` + a few `vp scrape` calls over a large crawl when only some pages matter.
- Do not repeat a call that already succeeded; save results to files (`-o`, or redirect `--json` output) and reuse them.

## Good practice

- Respect the user's intent and the site's terms; only read public pages, never pages behind a login or other access control.
- Markdown output can be long: redirect to a file (`vp scrape <url> > page.md`) and read the parts you need.
- On `busy`, `rate_limited` or `maintenance` the CLI already retried; if it still fails, wait and try once more later.
- `credits_exhausted`, `key_limit_reached`, `daily_limit_reached`: stop and tell the user.
