Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/docs/v4/basics/act.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ You can pass additional options to configure the model, timeout, variables, targ
// Custom model configuration
await stagehand.act("choose 'Peach' from the favorite color dropdown", {
model: {
modelName: "google/gemini-2.5-flash",
modelName: "google/gemini-3.8-flash",
apiKey: process.env.GOOGLE_API_KEY,
},
timeout: 10000,
Expand All @@ -307,7 +307,7 @@ from stagehand import ModelConfig
await stagehand.act(
"choose 'Peach' from the favorite color dropdown",
model=ModelConfig(
model_name="google/gemini-2.5-flash",
model_name="google/gemini-3.8-flash",
api_key=os.environ["GOOGLE_API_KEY"],
),
timeout=10000,
Expand All @@ -322,7 +322,7 @@ await stagehand.act(
// Custom model configuration
modelAPIKey := os.Getenv("GOOGLE_API_KEY")
model := stagehand.ModelConfig{
ModelName: "google/gemini-2.5-flash",
ModelName: "google/gemini-3.8-flash",
APIKey: &modelAPIKey,
}
timeout := 10000.0
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/v4/basics/extract.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ const result = await stagehand.extract(
z.object({ name: z.string() }),
{
model: {
modelName: "anthropic/claude-sonnet-4-6",
modelName: "anthropic/claude-sonnet-5",
apiKey: process.env.ANTHROPIC_API_KEY,
},
timeout: 30000,
Expand All @@ -402,7 +402,7 @@ result = await stagehand.extract(
"extract the repository name",
Repository,
model=ModelConfig(
model_name="anthropic/claude-sonnet-4-6",
model_name="anthropic/claude-sonnet-5",
api_key=os.environ["ANTHROPIC_API_KEY"],
),
timeout=30000,
Expand All @@ -416,7 +416,7 @@ result = await stagehand.extract(

modelAPIKey := os.Getenv("ANTHROPIC_API_KEY")
model := stagehand.ModelConfig{
ModelName: "anthropic/claude-sonnet-4-6",
ModelName: "anthropic/claude-sonnet-5",
APIKey: &modelAPIKey,
}
timeout := 30000.0
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/v4/basics/observe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ const page = await stagehand.browser.context.activePage();
// Custom model configuration
const { data: actions } = await stagehand.observe("find navigation links", {
model: {
modelName: "openai/gpt-5.4-mini",
modelName: "openai/gpt-5.6-luna",
apiKey: process.env.OPENAI_API_KEY,
},
timeout: 30000,
Expand All @@ -285,7 +285,7 @@ page = await stagehand.browser.context.active_page()
result = await stagehand.observe(
"find navigation links",
model=ModelConfig(
model_name="openai/gpt-5.4-mini",
model_name="openai/gpt-5.6-luna",
api_key=os.environ["OPENAI_API_KEY"],
),
timeout=30000,
Expand All @@ -299,7 +299,7 @@ result = await stagehand.observe(
// Custom model configuration
modelAPIKey := os.Getenv("OPENAI_API_KEY")
model := stagehand.ModelConfig{
ModelName: "openai/gpt-5.4-mini",
ModelName: "openai/gpt-5.6-luna",
APIKey: &modelAPIKey,
}
timeout := 30000.0
Expand Down
10 changes: 5 additions & 5 deletions packages/docs/v4/best-practices/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,8 @@ const browser = await browserbase.launch({ apiKey: process.env.BROWSERBASE_API_K

const stagehand = await Stagehand.create({
browser,
model: { modelName: "openai/gpt-5" }, // Routed through Model Gateway
cache: true, // Served by Browserbase Cache
model: { modelName: "openai/gpt-5.6-sol" }, // Routed through Model Gateway
cache: true, // Served by Browserbase Cache
});
```
</Tab>
Expand All @@ -611,8 +611,8 @@ browser = await browserbase.launch(api_key=os.environ["BROWSERBASE_API_KEY"])

stagehand = await Stagehand.create(
browser=browser,
model="openai/gpt-5", # Routed through Model Gateway
cache=True, # Served by Browserbase Cache
model="openai/gpt-5.6-sol", # Routed through Model Gateway
cache=True, # Served by Browserbase Cache
)
```
</Tab>
Expand All @@ -621,7 +621,7 @@ stagehand = await Stagehand.create(
```go
apiKey := os.Getenv("BROWSERBASE_API_KEY")
// Routed through Model Gateway: no model API key
model := stagehand.ModelConfig{ModelName: "openai/gpt-5"}
model := stagehand.ModelConfig{ModelName: "openai/gpt-5.6-sol"}
cache := stagehand.CacheEnabled(true) // Served by Browserbase Cache

browser, err := stagehand.LaunchBrowserbase(ctx, stagehand.BrowserbaseLaunchOptions{
Expand Down
18 changes: 9 additions & 9 deletions packages/docs/v4/best-practices/cost-optimization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Reach for a stronger model only on the calls that need it, with a per-call model
const stagehand = await Stagehand.create({
browser: await browserbase.launch({ apiKey: process.env.BROWSERBASE_API_KEY }),
model: {
modelName: "google/gemini-2.5-flash",
modelName: "google/gemini-3.8-flash",
},
});

Expand All @@ -31,7 +31,7 @@ const termsSchema = z.object({ summary: z.string() });
// One hard extraction gets the expensive model, everything else stays cheap
await stagehand.extract("summarize the contract terms", termsSchema, {
model: {
modelName: "anthropic/claude-sonnet-4-6",
modelName: "anthropic/claude-sonnet-5",
apiKey: process.env.ANTHROPIC_API_KEY,
},
});
Expand All @@ -48,7 +48,7 @@ browser = await browserbase.launch(api_key=os.environ["BROWSERBASE_API_KEY"])

stagehand = await Stagehand.create(
browser=browser,
model="google/gemini-2.5-flash",
model="google/gemini-3.8-flash",
model_api_key=os.environ["GOOGLE_GENERATIVE_AI_API_KEY"],
)

Expand All @@ -60,7 +60,7 @@ await stagehand.extract(
instruction="summarize the contract terms",
schema=Terms,
model=ModelConfig(
model_name="anthropic/claude-sonnet-4-6",
model_name="anthropic/claude-sonnet-5",
api_key=os.environ["ANTHROPIC_API_KEY"],
),
)
Expand All @@ -76,7 +76,7 @@ type terms struct {
apiKey := os.Getenv("BROWSERBASE_API_KEY")
googleKey := os.Getenv("GOOGLE_GENERATIVE_AI_API_KEY")
cheapModel := stagehand.ModelConfig{
ModelName: "google/gemini-2.5-flash",
ModelName: "google/gemini-3.8-flash",
APIKey: &googleKey,
}

Expand All @@ -98,7 +98,7 @@ if err != nil {
// One hard extraction gets the expensive model, everything else stays cheap
anthropicKey := os.Getenv("ANTHROPIC_API_KEY")
strongModel := stagehand.ModelConfig{
ModelName: "anthropic/claude-sonnet-4-6",
ModelName: "anthropic/claude-sonnet-5",
APIKey: &anthropicKey,
}

Expand Down Expand Up @@ -270,7 +270,7 @@ Automatically fall back to cheaper models for simple tasks. Escalate on `observe
// See stagehand.dev/evals for performance comparisons
async function smartAct(stagehand: Stagehand, prompt: string) {
const models = [
{ modelName: "google/gemini-2.5-flash", apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY },
{ modelName: "google/gemini-3.8-flash", apiKey: process.env.GOOGLE_GENERATIVE_AI_API_KEY },
{ modelName: "openai/gpt-5.4", apiKey: process.env.OPENAI_API_KEY },
] as const;

Expand Down Expand Up @@ -299,7 +299,7 @@ async function smartAct(stagehand: Stagehand, prompt: string) {
async def smart_act(stagehand: Stagehand, prompt: str):
models = [
{
"model_name": "google/gemini-2.5-flash",
"model_name": "google/gemini-3.8-flash",
"api_key": os.environ["GOOGLE_GENERATIVE_AI_API_KEY"],
},
{"model_name": "openai/gpt-5.4", "api_key": os.environ["OPENAI_API_KEY"]},
Expand Down Expand Up @@ -334,7 +334,7 @@ func smartAct(ctx context.Context, client *stagehand.Stagehand, prompt string) (

models := []stagehand.ModelConfig{
stagehand.ModelConfig{
ModelName: "google/gemini-2.5-flash",
ModelName: "google/gemini-3.8-flash",
APIKey: &googleKey,
},
stagehand.ModelConfig{
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/v4/best-practices/deployments.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async function run(): Promise<string> {
const stagehand = await Stagehand.create({
browser,
model: {
modelName: "google/gemini-2.5-flash",
modelName: "google/gemini-3.8-flash",
},
logging: { level: "warn", format: "json" },
});
Expand Down Expand Up @@ -175,7 +175,7 @@ async def run() -> str:

stagehand = await Stagehand.create(
browser=browser,
model="google/gemini-2.5-flash",
model="google/gemini-3.8-flash",
model_api_key=os.environ["GOOGLE_API_KEY"],
logging=StagehandClientLoggingConfig(level="warn", format="json"),
)
Expand Down Expand Up @@ -271,7 +271,7 @@ func run(ctx context.Context) (result string, err error) {
blockAds := true

model := stagehand.ModelConfig{
ModelName: "google/gemini-2.5-flash",
ModelName: "google/gemini-3.8-flash",
APIKey: &modelAPIKey,
}

Expand Down
Loading
Loading