> ## Documentation Index
> Fetch the complete documentation index at: https://docs.browserbase.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Gateway

> Access top LLM providers through your Browserbase API key: one key, one bill, no provider accounts needed.

Model Gateway lets you use [Stagehand](https://docs.stagehand.dev/) without wiring up model providers yourself. Instead of managing separate API keys for OpenAI, Anthropic, and Google, just use your Browserbase API key and pick a model. Browserbase routes the request to the upstream provider for you.

## Setup

When you provide only a Browserbase API key (without a provider-specific key), Stagehand automatically routes model requests through Model Gateway. No additional configuration needed.

```typescript Node.js theme={null}
import { browserbase, Stagehand } from "@browserbasehq/stagehand";

const browser = await browserbase.launch({
  apiKey: process.env.BROWSERBASE_API_KEY,
});
const stagehand = await Stagehand.create({
  browser,
  model: { modelName: "openai/gpt-5" },
});
```

Omit `model` to let Model Gateway select one for each `act`, `extract`, and `observe` call. See [Stagehand model configuration](https://docs.stagehand.dev/v4/configuration/models) to pin a model or bring your own provider.

<Note>
  Model Gateway requires Browserbase-hosted browsers. It does not work with local browsers.
</Note>

## Switching models

With Model Gateway, switching between providers is a config change. No new accounts, API keys, or code rewiring required:

<Tabs>
  <Tab title="OpenAI">
    ```typescript Node.js theme={null}
    const stagehand = await Stagehand.create({
      browser: await browserbase.launch({ apiKey: process.env.BROWSERBASE_API_KEY }),
      model: { modelName: "openai/gpt-5" },
    });
    ```
  </Tab>

  <Tab title="Anthropic">
    ```typescript Node.js theme={null}
    const stagehand = await Stagehand.create({
      browser: await browserbase.launch({ apiKey: process.env.BROWSERBASE_API_KEY }),
      model: { modelName: "anthropic/claude-sonnet-4-6" },
    });
    ```
  </Tab>

  <Tab title="Google">
    ```typescript Node.js theme={null}
    const stagehand = await Stagehand.create({
      browser: await browserbase.launch({ apiKey: process.env.BROWSERBASE_API_KEY }),
      model: { modelName: "google/gemini-2.5-flash" },
    });
    ```
  </Tab>
</Tabs>

## Key benefits

* **One key, one bill**: LLM inference, browser infrastructure, and caching all run through your Browserbase API key. No separate provider accounts to manage.
* **Market-price tokens**: Tokens are billed at the same price as going direct to the provider. No markup.
* **Built-in reliability**: Retries, backoff, and rate limit handling are managed for you.
* **No tier-gating**: Access new models immediately without hitting provider spend thresholds. No need to "earn" access to the latest releases.
* **Action caching**: Model Gateway works with Stagehand's managed action caching, so repeated steps are reused instead of re-run, reducing cost and latency across sessions.

## Supported providers

| Provider  | Example Model                 |
| --------- | ----------------------------- |
| OpenAI    | `openai/gpt-5`                |
| Anthropic | `anthropic/claude-sonnet-4-6` |
| Google    | `google/gemini-2.5-flash`     |

<Tip>
  Need a provider that isn't listed? [Reach out](https://www.browserbase.com/contact). Browserbase is happy to work with teams on additional model support.
</Tip>

## Pricing

Model Gateway tokens are billed at market price, the same rate you'd pay going direct to the provider. There is no additional markup. Usage appears on your existing Browserbase bill alongside browser time, proxy bandwidth, and other platform usage.

See [Plans](/account/billing/plans) for details on included allocations and overages.

## Next steps

<CardGroup cols={2}>
  <Card title="Stagehand" icon="wand-magic-sparkles" iconType="sharp-solid" href="https://docs.stagehand.dev/">
    The AI SDK for browser agents. Natural language selectors, self-healing actions, and built-in caching.
  </Card>

  <Card title="Agents" icon="robot" iconType="sharp-solid" href="/platform/agents/overview">
    Configure, deploy and run managed agents on Browserbase.
  </Card>
</CardGroup>
