|
| 1 | +--- |
| 2 | +title: "CLI" |
| 3 | +description: "Read the web from your terminal. Built for AI coding agents." |
| 4 | +--- |
| 5 | + |
| 6 | +The Reader CLI lets you scrape, crawl, and take screenshots from the command line. It's a thin wrapper around the [Reader API](/api-reference/read) - no local browser needed. |
| 7 | + |
| 8 | +Built for AI coding agents like Claude Code, Cursor, and Codex, but works great for humans too. |
| 9 | + |
| 10 | +## Install |
| 11 | + |
| 12 | +```bash |
| 13 | +npm install -g @vakra-dev/reader-cli |
| 14 | +``` |
| 15 | + |
| 16 | +Or run directly without installing: |
| 17 | + |
| 18 | +```bash |
| 19 | +npx @vakra-dev/reader-cli scrape https://example.com |
| 20 | +``` |
| 21 | + |
| 22 | +## Authentication |
| 23 | + |
| 24 | +<Tabs> |
| 25 | + <Tab title="For humans"> |
| 26 | + Run once to save your API key: |
| 27 | + ```bash |
| 28 | + reader config set api-key rdr_your_key_here |
| 29 | + ``` |
| 30 | + The key is saved to `~/.reader/config.json` and used for all future commands. |
| 31 | + </Tab> |
| 32 | + <Tab title="For AI agents / CI"> |
| 33 | + Set the environment variable: |
| 34 | + ```bash |
| 35 | + export READER_API_KEY=rdr_your_key_here |
| 36 | + ``` |
| 37 | + The env var takes precedence over the config file. No disk writes needed. |
| 38 | + </Tab> |
| 39 | +</Tabs> |
| 40 | + |
| 41 | +Get your API key from the [Reader dashboard](https://console.reader.dev). |
| 42 | + |
| 43 | +## Scrape a page |
| 44 | + |
| 45 | +```bash |
| 46 | +reader scrape https://example.com |
| 47 | +``` |
| 48 | + |
| 49 | +Output is clean markdown, printed to stdout. Pipe it anywhere: |
| 50 | + |
| 51 | +```bash |
| 52 | +reader scrape https://docs.stripe.com/payments > stripe-payments.md |
| 53 | +``` |
| 54 | + |
| 55 | +### Formats |
| 56 | + |
| 57 | +```bash |
| 58 | +reader scrape https://example.com # markdown (default) |
| 59 | +reader scrape https://example.com -f html # cleaned HTML |
| 60 | +reader scrape https://example.com -f screenshot -o page.png # full-page PNG |
| 61 | +``` |
| 62 | + |
| 63 | +### JSON output |
| 64 | + |
| 65 | +Get the full API response with metadata: |
| 66 | + |
| 67 | +```bash |
| 68 | +reader scrape https://example.com --json |
| 69 | +``` |
| 70 | + |
| 71 | +```json |
| 72 | +{ |
| 73 | + "url": "https://example.com", |
| 74 | + "markdown": "# Example Domain\n\n...", |
| 75 | + "metadata": { |
| 76 | + "duration": 892, |
| 77 | + "cached": false, |
| 78 | + "proxyMode": "standard" |
| 79 | + }, |
| 80 | + "pageMetadata": { |
| 81 | + "title": "Example Domain" |
| 82 | + } |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +### Options |
| 87 | + |
| 88 | +```bash |
| 89 | +reader scrape <url> [options] |
| 90 | + |
| 91 | +Options: |
| 92 | + -f, --format <format> markdown (default), html, screenshot |
| 93 | + --json Full JSON response |
| 94 | + -o, --output <file> Write to file |
| 95 | + --no-main-content Include nav, header, footer |
| 96 | + --include-tags <sel> CSS selectors to keep (comma-separated) |
| 97 | + --exclude-tags <sel> CSS selectors to remove (comma-separated) |
| 98 | + --wait-for <selector> Wait for element before capturing |
| 99 | + --timeout <ms> Timeout in milliseconds (default: 30000) |
| 100 | + --proxy-mode <mode> standard, stealth, auto |
| 101 | +``` |
| 102 | + |
| 103 | +## Crawl a site |
| 104 | + |
| 105 | +Discover and scrape all pages on a website: |
| 106 | + |
| 107 | +```bash |
| 108 | +reader crawl https://docs.example.com |
| 109 | +``` |
| 110 | + |
| 111 | +Each page's markdown is output separated by `---`. Save to individual files: |
| 112 | + |
| 113 | +```bash |
| 114 | +reader crawl https://docs.example.com -o ./docs/ |
| 115 | +``` |
| 116 | + |
| 117 | +### URL discovery only |
| 118 | + |
| 119 | +List all discovered URLs without scraping content: |
| 120 | + |
| 121 | +```bash |
| 122 | +reader crawl https://docs.example.com --urls-only |
| 123 | +``` |
| 124 | + |
| 125 | +### Options |
| 126 | + |
| 127 | +```bash |
| 128 | +reader crawl <url> [options] |
| 129 | + |
| 130 | +Options: |
| 131 | + --max-depth <n> Crawl depth (default: 2) |
| 132 | + --max-pages <n> Max pages (default: 20) |
| 133 | + --urls-only Only list URLs, don't scrape |
| 134 | + --json Full JSON response |
| 135 | + -o, --output-dir <dir> Write each page to a separate file |
| 136 | +``` |
| 137 | +
|
| 138 | +## Check status |
| 139 | +
|
| 140 | +Verify your setup and see your credit balance: |
| 141 | +
|
| 142 | +```bash |
| 143 | +reader status |
| 144 | +``` |
| 145 | +
|
| 146 | +``` |
| 147 | +Reader CLI v0.1.0 |
| 148 | +API: https://api.reader.dev |
| 149 | +Key: rdr_...c3bb |
| 150 | +Credits: 874 / 1000 (free tier) |
| 151 | +Resets: 2026-07-01 |
| 152 | +``` |
| 153 | +
|
| 154 | +## Check credits |
| 155 | +
|
| 156 | +```bash |
| 157 | +reader credits |
| 158 | +``` |
| 159 | +
|
| 160 | +``` |
| 161 | +Balance: 874 / 1000 |
| 162 | +Used: 126 |
| 163 | +Tier: free |
| 164 | +Resets: 2026-07-01T00:00:00.000Z |
| 165 | +``` |
| 166 | +
|
| 167 | +## Configuration |
| 168 | +
|
| 169 | +```bash |
| 170 | +reader config set api-key <key> # save API key |
| 171 | +reader config set api-url <url> # custom API URL |
| 172 | +reader config show # show current config |
| 173 | +``` |
| 174 | +
|
| 175 | +Config is stored at `~/.reader/config.json`. Environment variables always take precedence: |
| 176 | +
|
| 177 | +| Setting | Env var | Config key | |
| 178 | +| --- | --- | --- | |
| 179 | +| API key | `READER_API_KEY` | `apiKey` | |
| 180 | +| API URL | `READER_API_URL` | `apiUrl` | |
| 181 | +
|
| 182 | +## For AI agents |
| 183 | +
|
| 184 | +The CLI is designed to work seamlessly with AI coding agents: |
| 185 | +
|
| 186 | +- **Markdown to stdout** - agents read the content directly |
| 187 | +- **Errors to stderr** - never pollutes piped output |
| 188 | +- **Exit codes** - 0 on success, 1 on error |
| 189 | +- **No interactive prompts** - everything via flags and env vars |
| 190 | +- **`--json` flag** - structured output for programmatic use |
| 191 | +
|
| 192 | +Example in a Claude Code or Cursor workflow: |
| 193 | +
|
| 194 | +```bash |
| 195 | +# Agent reads documentation to answer a question |
| 196 | +reader scrape https://docs.stripe.com/payments/quickstart |
| 197 | +
|
| 198 | +# Agent crawls a site for context |
| 199 | +reader crawl https://docs.example.com --max-pages 10 -o ./context/ |
| 200 | +
|
| 201 | +# Agent takes a screenshot for visual analysis |
| 202 | +reader scrape https://example.com -f screenshot -o page.png |
| 203 | +``` |
0 commit comments