Skip to content
Open
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
4 changes: 4 additions & 0 deletions packages/openai-adapters/src/apis/OpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export class OpenAIApi implements BaseLlmApi {
// Necessary because `new OpenAI()` will throw an error if there is no API Key
apiKey: config.apiKey ?? "",
baseURL: this.apiBase,
defaultHeaders: {
"openai-organization": undefined,
"openai-project": undefined,
},
fetch: customFetch(config.requestOptions),
timeout: config?.requestOptions?.timeout || undefined,
});
Expand Down
13 changes: 13 additions & 0 deletions packages/openai-adapters/src/test/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,19 @@ describe("Configuration", () => {
);
});

it("should disable optional OpenAI org/project headers with lowercase keys", () => {
const openai = constructLlmApi({
provider: "openai",
apiKey: "sk-xxx",
apiBase: "https://openrouter.ai/api/v1/",
}) as OpenAIApi;

expect((openai.openai as any)._options.defaultHeaders).toMatchObject({
"openai-organization": undefined,
"openai-project": undefined,
});
});

it("should configure Inception OpenAI client with correct apiBase and apiKey", () => {
const inception = constructLlmApi({
provider: "inception",
Expand Down
Loading