From ee1d20ecf13289f3185c3daacb8c0e54722a0ea3 Mon Sep 17 00:00:00 2001 From: Chris Rose Date: Wed, 16 Apr 2025 19:55:34 -0700 Subject: [PATCH] feat: allow OPENAI_CUSTOM_HEADERS to be set in goose config (#2235) --- crates/goose/src/providers/openai.rs | 1 + documentation/docs/getting-started/providers.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/goose/src/providers/openai.rs b/crates/goose/src/providers/openai.rs index 00b497fe..91a12058 100644 --- a/crates/goose/src/providers/openai.rs +++ b/crates/goose/src/providers/openai.rs @@ -58,6 +58,7 @@ impl OpenAiProvider { let project: Option = config.get_param("OPENAI_PROJECT").ok(); let custom_headers: Option> = config .get_secret("OPENAI_CUSTOM_HEADERS") + .or_else(|_| config.get_param("OPENAI_CUSTOM_HEADERS")) .ok() .map(parse_custom_headers); let timeout_secs: u64 = config.get_param("OPENAI_TIMEOUT").unwrap_or(600); diff --git a/documentation/docs/getting-started/providers.md b/documentation/docs/getting-started/providers.md index ae2990de..88c5dcf4 100644 --- a/documentation/docs/getting-started/providers.md +++ b/documentation/docs/getting-started/providers.md @@ -128,7 +128,7 @@ Goose supports using custom OpenAI-compatible endpoints, which is particularly u | `OPENAI_HOST` | No | Custom endpoint URL (defaults to api.openai.com) | | `OPENAI_ORGANIZATION` | No | Organization ID for usage tracking and governance | | `OPENAI_PROJECT` | No | Project identifier for resource management | -| `OPENAI_CUSTOM_HEADERS` | No | Additional headers to include in the request, in the format "HEADER_A=VALUE_A,HEADER_B=VALUE_B" | +| `OPENAI_CUSTOM_HEADERS` | No | Additional headers to include in the request. Can be set via environment variable, configuration file, or CLI, in the format `HEADER_A=VALUE_A,HEADER_B=VALUE_B`. | ### Example Configurations