@@ -95,7 +95,7 @@ private constructor(
9595 @get:JvmName(" maxRetries" ) val maxRetries: Int ,
9696 @get:JvmName(" browserbaseApiKey" ) val browserbaseApiKey: String ,
9797 @get:JvmName(" browserbaseProjectId" ) val browserbaseProjectId: String ,
98- private val modelApiKey: String? ,
98+ @get:JvmName( " modelApiKey " ) val modelApiKey: String ,
9999) {
100100
101101 init {
@@ -111,8 +111,6 @@ private constructor(
111111 */
112112 fun baseUrl (): String = baseUrl ? : PRODUCTION_URL
113113
114- fun modelApiKey (): Optional <String > = Optional .ofNullable(modelApiKey)
115-
116114 fun toBuilder () = Builder ().from(this )
117115
118116 companion object {
@@ -127,6 +125,7 @@ private constructor(
127125 * .httpClient()
128126 * .browserbaseApiKey()
129127 * .browserbaseProjectId()
128+ * .modelApiKey()
130129 * ```
131130 */
132131 @JvmStatic fun builder () = Builder ()
@@ -287,10 +286,7 @@ private constructor(
287286 this .browserbaseProjectId = browserbaseProjectId
288287 }
289288
290- fun modelApiKey (modelApiKey : String? ) = apply { this .modelApiKey = modelApiKey }
291-
292- /* * Alias for calling [Builder.modelApiKey] with `modelApiKey.orElse(null)`. */
293- fun modelApiKey (modelApiKey : Optional <String >) = modelApiKey(modelApiKey.getOrNull())
289+ fun modelApiKey (modelApiKey : String ) = apply { this .modelApiKey = modelApiKey }
294290
295291 fun headers (headers : Headers ) = apply {
296292 this .headers.clear()
@@ -383,7 +379,7 @@ private constructor(
383379 * |----------------------|--------------------------------|------------------------|--------|--------------------------------------------|
384380 * |`browserbaseApiKey` |`stagehand.browserbaseApiKey` |`BROWSERBASE_API_KEY` |true |- |
385381 * |`browserbaseProjectId`|`stagehand.browserbaseProjectId`|`BROWSERBASE_PROJECT_ID`|true |- |
386- * |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |false |- |
382+ * |`modelApiKey` |`stagehand.modelApiKey` |`MODEL_API_KEY` |true |- |
387383 * |`baseUrl` |`stagehand.baseUrl` |`STAGEHAND_BASE_URL` |true |`"https://api.stagehand.browserbase.com/v1"`|
388384 *
389385 * System properties take precedence over environment variables.
@@ -413,6 +409,7 @@ private constructor(
413409 * .httpClient()
414410 * .browserbaseApiKey()
415411 * .browserbaseProjectId()
412+ * .modelApiKey()
416413 * ```
417414 *
418415 * @throws IllegalStateException if any required field is unset.
@@ -422,6 +419,7 @@ private constructor(
422419 val sleeper = sleeper ? : PhantomReachableSleeper (DefaultSleeper ())
423420 val browserbaseApiKey = checkRequired(" browserbaseApiKey" , browserbaseApiKey)
424421 val browserbaseProjectId = checkRequired(" browserbaseProjectId" , browserbaseProjectId)
422+ val modelApiKey = checkRequired(" modelApiKey" , modelApiKey)
425423
426424 val headers = Headers .builder()
427425 val queryParams = QueryParams .builder()
@@ -442,7 +440,7 @@ private constructor(
442440 headers.put(" x-bb-project-id" , it)
443441 }
444442 }
445- modelApiKey? .let {
443+ modelApiKey.let {
446444 if (! it.isEmpty()) {
447445 headers.put(" x-model-api-key" , it)
448446 }
0 commit comments