Skip to content

Commit f3fe7ce

Browse files
Include LLM headers in ModelConfig (browserbase#1874)
# why Custom headers for LLM requests are supported in Stagehand, canonical SDKs were not accounting for this until now. # what changed Added headers to ModelConfig # test plan <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds an optional `headers` field to `ModelConfig` to send custom headers with every LLM request. Also includes a patch changeset for `@browserbasehq/stagehand`. - **New Features** - Add `headers?: Record<string, string>` to `ModelConfigObjectSchema` in `packages/core/lib/v3/types/public/api.ts`. - Update `packages/server-v3/openapi.v3.yaml` to document `headers` in `ModelConfig`. - Update `packages/server-v4/openapi.v4.yaml` to use selector-based result/output schemas for page actions (click, hover, scroll, drag-and-drop) and add `returnSelector` support. <sup>Written for commit f83bd8b. Summary will update on new commits. <a href="https://cubic.dev/pr/browserbase/stagehand/pull/1874">Review in cubic</a></sup> <!-- End of auto-generated description by cubic. --> --------- Co-authored-by: Sean McGuire <seanmcguire1@outlook.com>
1 parent 8bf5db8 commit f3fe7ce

4 files changed

Lines changed: 292 additions & 17 deletions

File tree

.changeset/odd-grapes-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@browserbasehq/stagehand": patch
3+
---
4+
5+
Add headers (LLM) to ModelConfig

packages/core/lib/v3/types/public/api.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export const ModelConfigObjectSchema = z
7979
description: "Base URL for the model provider",
8080
example: "https://api.openai.com/v1",
8181
}),
82+
headers: z.record(z.string(), z.string()).optional().meta({
83+
description:
84+
"Custom headers sent with every request to the model provider",
85+
}),
8286
})
8387
.meta({ id: "ModelConfigObject" });
8488

packages/server-v3/openapi.v3.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,13 @@ components:
193193
example: https://api.openai.com/v1
194194
type: string
195195
format: uri
196+
headers:
197+
description: Custom headers sent with every request to the model provider
198+
type: object
199+
propertyNames:
200+
type: string
201+
additionalProperties:
202+
type: string
196203
required:
197204
- modelName
198205
ModelConfig:
@@ -1225,6 +1232,13 @@ components:
12251232
example: https://api.openai.com/v1
12261233
type: string
12271234
format: uri
1235+
headers:
1236+
description: Custom headers sent with every request to the model provider
1237+
type: object
1238+
propertyNames:
1239+
type: string
1240+
additionalProperties:
1241+
type: string
12281242
required:
12291243
- modelName
12301244
additionalProperties: false

0 commit comments

Comments
 (0)