Setup
When only a Browserbase API key is provided (without a provider-specific API key), Stagehand automatically routes model requests through Model Gateway. No additional configuration is needed.Model Gateway requires Browserbase-hosted browsers. It does not work with
env: "LOCAL".Switching models
With Model Gateway, switching between providers is a config change — no new accounts, API keys, or code rewiring required:- OpenAI
- Anthropic
- Google
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/gemini-2.5-flash |
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 for details on included allocations and overages.Next steps
Stagehand
The AI SDK for browser agents. Natural language selectors, self-healing actions, and built-in caching.
Functions
Deploy your Stagehand agents as serverless functions on Browserbase infrastructure.