# Cloud browser API for web data and automation | Spider

Spider Browser is a cloud browser API for web scraping, crawling and automation. Connect from the SDK, Playwright or Puppeteer over CDP. Pay per use.

Canonical: https://spider.cloud/browser/

## The cloud browser for web data and automation.

Connect Playwright, Puppeteer or the Spider SDK to a browser Spider runs, and let your agent drive it.

[Get an API key](https://spider.cloud/register/?next=%2Fplayground%2F%3Fview%3Dbrowser)

Calls, 3 of the 7 recorded

```
await browser.goto("https://books.toscrape.com/")await browser.page.click('a[href*="travel_2"]')const row = await browser.page.extractFields({  heading: "h1",  results: "form.form-horizontal strong",  title: {    selector: "article.product_pod h3 a",    attribute: "title",  },  price: "article.product_pod .price_color",  stock: "article.product_pod .availability",})
```

Returns, in 107 ms

- heading

  "Travel"

- results

  "11"

- title

  "It's Only the Himalayas"

- price

  "£45.17"

- stock

  "In stock"

Recorded Nov 17, 2026 with spider-browser 0.3.0 (npm) against books.toscrape.com, a public sandbox site. [Read the docs](https://spider.cloud/docs/core/spider-browser/)

In [Browser Fidelity Bench V1](https://github.com/spider-rs/benchmark), Spider passed 80/80 tasks on Sep 18, 2026, each a real page on a protected production site.

Pay as you go, from $1 per GB of bandwidth plus $0.0001 per minute a request runs.

[Get an API key](https://spider.cloud/register/?next=%2Fplayground%2F%3Fview%3Dbrowser)

## One session, recorded call by call.

Recorded on Nov 17, 2026 with the spider-browser npm SDK against books.toscrape.com, a public sandbox site: seven calls, 7.4 seconds, 1.625 credits.

books.toscrape.com Nov 17, 2026

[init 1,296 milliseconds ](#si-init)[goto 1,828 milliseconds ](#si-goto)[observe 1,559 milliseconds ](#si-observe)[click 2,136 milliseconds ](#si-click)[extractFields 107 milliseconds ](#si-extractFields)[content 187 milliseconds ](#si-content)[close 43 milliseconds](#si-close)

### init

Attaches to a browser that is already running and returns a session.

```
const browser = new SpiderBrowser({
  apiKey: process.env.SPIDER_API_KEY,
})
await browser.init()
```

```
key = os.environ["SPIDER_API_KEY"]
browser = SpiderBrowser(
    SpiderBrowserOptions(api_key=key)
)
await browser.init()
```

```
let key = std::env::var("SPIDER_API_KEY")
    .expect("SPIDER_API_KEY");
let mut browser = SpiderBrowser::new(
    SpiderBrowserOptions::new(key),
);
browser.init().await?;
```

Returns

void

- Elapsed

  1.343 s

- Credits

  0.0277

- Cost

  $0.00000277

### goto

Loads a URL in the session.

```
await browser.goto(
  "https://books.toscrape.com/",
)
```

```
await browser.goto(
    "https://books.toscrape.com/"
)
```

```
browser
    .goto("https://books.toscrape.com/")
    .await?;
```

Returns

void

- Elapsed

  3.215 s

- Credits

  0.1769

- Cost

  $0.00001769

### observe

Lists the elements on the page with their selectors, and ran with no model key.

```
const elements = await browser.observe()
```

```
elements = await browser.observe()
```

```
let elements =
    browser.observe(None).await?;
```

Returns 114 elements, the first 4

- "Books to Scrape"

  232 × 36 at 58, 51

- "Home"

  38 × 16 at 103, 169

- "Books"

  235 × 40 at 108, 235

- "Travel"

  37 × 16 at 133, 277

* Elapsed

  4.817 s

* Credits

  0.6964

* Cost

  $0.00006964

### click

Clicks a selector, here the Travel category link.

```
await browser.page.click(
  'a[href*="travel_2"]',
)
for (let i = 0; i < 40; i++) {
  const url = await browser.page.url()
  if (url.includes("travel_2")) break
  await sleep(50)
}
await browser.page.waitForSelector(
  "article.product_pod",
)
```

```
await browser.page.click(
    'a[href*="travel_2"]'
)
for _ in range(40):
    url = await browser.page.url()
    if "travel_2" in url:
        break
    await asyncio.sleep(0.05)
await browser.page.wait_for_selector(
    "article.product_pod"
)
```

```
browser
    .page()
    .click(r#"a[href*="travel_2"]"#)
    .await?;
for _ in 0..40 {
    let url = browser.page().url().await?;
    if url.contains("travel_2") {
        break;
    }
    sleep(Duration::from_millis(50)).await;
}
browser
    .page()
    .wait_for_selector(
        "article.product_pod",
        5000,
    )
    .await?;
```

In plain words, on your model key

```
await browser.act("Open the Travel category")
```

```
await browser.act("Open the Travel category")
```

```
browser.act("Open the Travel category").await?;
```

Lands on

- url

  https\://books.toscrape.com/catalogue/category/books/travel_2/index.html

- title

  Travel | Books to Scrape - Sandbox

* Elapsed

  6.999 s

* Credits

  0.8822

* Cost

  $0.00008822

### extractFields

Reads named fields by selector.

```
const row = await browser.page.extractFields({
  heading: "h1",
  results: "form.form-horizontal strong",
  title: {
    selector: "article.product_pod h3 a",
    attribute: "title",
  },
  price: "article.product_pod .price_color",
  stock: "article.product_pod .availability",
})
```

```
row = await browser.page.extract_fields({
    "heading": "h1",
    "results": "form.form-horizontal strong",
    "title": {
        "selector": "article.product_pod h3 a",
        "attribute": "title",
    },
    "price": "article.product_pod .price_color",
    "stock": "article.product_pod .availability",
})
```

```
let row = browser.page().extract_fields(&[
    ("heading", "h1".into()),
    ("results", "form.form-horizontal strong".into()),
    ("title", FieldSelector::Attr {
        selector: "article.product_pod h3 a",
        attribute: "title",
    }),
    ("price", "article.product_pod .price_color".into()),
    ("stock", "article.product_pod .availability".into()),
]).await?;
```

In plain words, on your model key

```
await browser.extract("The first book", { schema: Book })
```

```
await browser.extract("The first book", Book)
```

```
let book: Book = browser.extract("The first book").await?;
```

Returns

- heading

  "Travel"

- results

  "11"

- title

  "It's Only the Himalayas"

- price

  "£45.17"

- stock

  "In stock"

* Elapsed

  7.150 s

* Credits

  0.9095

* Cost

  $0.00009095

### content

Returns the rendered HTML.

```
const html = await browser.page.content()
```

```
html = await browser.page.content()
```

```
let html = browser
    .page()
    .content(8000, 1000)
    .await?;
```

Returns

- html

  36,758 bytes

* Elapsed

  7.380 s

* Credits

  1.6220

* Cost

  $0.00016220

### close

Ends the session and the meter.

```
const credits =
  await browser.getSessionCredits()
await browser.close()
```

```
credits = (
    await browser.get_session_credits()
)
await browser.close()
```

```
let credits =
    browser.session_credits_used();
browser.close();
```

Returns

- credits

  1.625

* Elapsed

  7.423 s

* Credits

  1.6250

* Cost

  $0.00016250

Or hand over the whole task, on your own model key.

```
await browser.agent().execute("Find the cheapest Travel book")
```

```
await browser.agent().execute("Find the cheapest Travel book")
```

```
browser.agent(None).execute("Find the cheapest Travel book").await;
```

## Readings, each with its run.

Latency is a raw CDP client on a laptop over the public internet, medians from the run of Nov 17, 2026.

Limits

- open sessions

  1,000 per account

- new sessions

  100 /min per account

- commands

  500 /s per session, bursts to 1,000

- session length

  30 min maximum

Latency, median Nov 17, 2026

- connect

  754 ms `example.com`, 50 rounds

- session create

  1,069 ms `example.com`, 50 rounds

- session close

  44 ms `example.com`, 50 rounds

Browser Fidelity Bench V1

1. Spider 100%
2. Browser Use Cloud 81%
3. Anchor 74%
4. Onkernel 68%
5. Browserless 56%
6. Local Headful Chrome local 49%
7. Steel 44%
8. Hyperbrowser 44%
9. Browserbase 41%
10. Local Headless Chrome local 3%

80 tasks, Spider run Sep 18, 2026, other rows as measured Mar 22, 2026 and not re-run.

[Source](https://github.com/spider-rs/benchmark)

999 / 999

URLs loaded across 254 domains in a separate run. The public dataset lists each URL with its outcome, results published Feb 17, 2026.

[Dataset ](https://github.com/spider-rs/spider-browser-dataset)[Write-up](https://spider.cloud/blog/spider-browser-vs-kernel-browserbase-benchmark/)

## Pick a way in.

The SDK and CDP clients connect to wss\://browser.spider.cloud/v1/browser with your Spider API key, whether the job is scraping, crawling or automation.

SDK

- `npm install spider-browser` [npm](https://www.npmjs.com/package/spider-browser)
- `pip install spider-browser` [PyPI](https://pypi.org/project/spider-browser/)
- `cargo add spider-browser` [crates.io](https://crates.io/crates/spider-browser)

* MCP server

  - Browser tools for Claude, Cursor or any MCP client: open, navigate, click, fill, screenshot and content.
  - [Set up MCP](https://spider.cloud/mcp/)

* Desktop app

  - The same browser as an app for macOS on Apple silicon, Windows and Linux.
  - [macOS ](https://api.spider.cloud/data/download/browser?platform=macos-arm64)[Windows ](https://api.spider.cloud/data/download/browser?platform=windows-x64)[Linux](https://api.spider.cloud/data/download/browser?platform=linux-x64-appimage)

```
import { chromium } from "playwright"

const url =
  "wss://browser.spider.cloud/v1/browser"
const key = process.env.SPIDER_API_KEY

const browser =
  await chromium.connectOverCDP(
    url + "?token=" + key,
  )
const page = await browser.newPage()
await page.goto("https://books.toscrape.com/")
console.log(await page.title())
await browser.close()
```

```
import puppeteer from "puppeteer-core"

const url =
  "wss://browser.spider.cloud/v1/browser"
const key = process.env.SPIDER_API_KEY

const browser = await puppeteer.connect({
  browserWSEndpoint: url + "?token=" + key,
})
const page = await browser.newPage()
await page.goto("https://books.toscrape.com/")
console.log(await page.title())
await browser.close()
```

Pass the endpoint to connectOverCDP() or puppeteer.connect() with your key as the token and keep your script. A page you only need to read does not need a session. The [web scraping API](/api/scrape/) returns it as markdown from one request.

[Session parameters](https://spider.cloud/docs/api/browser/)

## Pay for what a session uses.

Pay as you go at two rates, with no monthly minimum, and a total that depends on how much the site transfers.

- per GB transferred

  from $1

- per minute a session is open

  $0.0001

The meter runs every 3 seconds from init() to close(), pro-rated to the millisecond, and recording adds 15% to compute.

[The full meter](https://spider.cloud/guides/pricing-and-plans/#how-minutes-are-metered)

Receipt, Nov 17, 2026

- calls

  7

- open for

  7.4 s

- credits

  1.625

- total

  $0.00016250

## Questions.

Can I keep my Playwright or Puppeteer code?

Yes. The session speaks CDP over a WebSocket, so your script attaches to it and the session settings, the proxy country included, apply to what the script does next. act, observe, extract and agent are SDK calls, so a script that wants them uses the SDK.

Which model providers work with act, extract and agent?

OpenAI, Anthropic and OpenRouter. Pass an llm option with the provider, a model name and your key.

What happens when I call close()?

It drops the WebSocket, and the server disposes the contexts and targets that belonged to the session.

How do I run more work at once?

Open more sessions. The 999 URL run held 25 sessions open for 19 minutes with no failures. When a session reaches its time limit the server ends it, so open a new one and carry on.

What am I billed for?

Bandwidth and the minutes a session is open, drawn from pay as you go credits. Your model provider bills the calls that act, extract and agent make. About every 30 seconds the server checks your balance, and at zero it ends the session.

How does it compare with other cloud browsers?

The bench board in the readings section lists each provider with its score and the date of its reading. The tasks and the harness are public at github.com/spider-rs/benchmark, so you can run them against any provider.

### Keep reading.

[Why Spider](https://spider.cloud/why-spider/)

[One key for the three hosts Spider runs.](https://spider.cloud/why-spider/)

[AI agents](https://spider.cloud/use-cases/ai-agents/)

[Give an agent a session and the calls to read a page and act on it.](https://spider.cloud/use-cases/ai-agents/)

[MCP server](https://spider.cloud/mcp/)

[Add the server once and your MCP client can open a session.](https://spider.cloud/mcp/)

[API reference](https://spider.cloud/docs/api/browser/)

[Session parameters, CDP details and every call.](https://spider.cloud/docs/api/browser/)

## Run the same seven calls yourself.

Create an account, open the browser view in the playground and start a session with your key.

[Get an API key](https://spider.cloud/register/?next=%2Fplayground%2F%3Fview%3Dbrowser)
