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
15 changes: 14 additions & 1 deletion packages/proxy/schema/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MessageCreateParamsBase } from "@anthropic-ai/sdk/resources/messages";
import { GenerateContentParameters } from "../types/google";
import { ChatCompletionCreateParams } from "openai/resources";
import { describe, expect, it } from "vitest";
import { describe, expect, expectTypeOf, it } from "vitest";
import { APISecretSchema } from "./secrets";
import { ModelFormat } from "./index";
import { translateParams } from "./translate";
Expand Down Expand Up @@ -325,6 +325,19 @@ describe("APISecretSchema compatibility", () => {
});
});

it("accepts org ids as a top-level API secret field", () => {
const parsed = APISecretSchema.parse({
secret: "provider-secret",
type: "openai",
org_id: "org-id",
org_name: "org-name",
metadata: {},
});

expectTypeOf(parsed.org_id).toEqualTypeOf<string | null | undefined>();
expect(parsed.org_id).toBe("org-id");
});

it("accepts Anthropic OAuth bearer metadata", () => {
const parsed = APISecretSchema.parse({
secret: "anthropic-access-token",
Expand Down
1 change: 1 addition & 0 deletions packages/proxy/schema/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export const BraintrustMetadataSchema = BaseMetadataSchema.merge(
const APISecretBaseSchema = z
.object({
id: z.string().uuid().nullish(),
org_id: z.string().nullish(),
org_name: z.string().nullish(),
name: z.string().nullish(),
secret: z.string(),
Expand Down
Loading