
























@@ -2,6 +2,9 @@ import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
22import { captureEnv } from "../test-utils/env.js";
3344vi.mock("../plugins/provider-runtime.js", () => ({
5+normalizeProviderConfigWithPlugin: vi.fn(
6+(params: { context?: { providerConfig?: unknown } }) => params.context?.providerConfig,
7+),
58resolveProviderSyntheticAuthWithPlugin: vi.fn(),
69}));
710@@ -240,7 +243,7 @@ describe("models-config provider auth provenance", () => {
240243providers: {
241244vllm: {
242245baseUrl: "http://127.0.0.1:8000/v1",
243-apiKey: "MY_VLLM_KEY",
246+apiKey: "${MY_VLLM_KEY}",
244247api: "openai-completions",
245248models: [],
246249},
@@ -255,6 +258,60 @@ describe("models-config provider auth provenance", () => {
255258});
256259});
257260261+it("does not send missing known provider env markers as catalog discovery keys", () => {
262+const auth = createProviderApiKeyResolver(
263+{} as NodeJS.ProcessEnv,
264+{
265+version: 1,
266+profiles: {},
267+},
268+{
269+models: {
270+providers: {
271+vllm: {
272+baseUrl: "http://127.0.0.1:8000/v1",
273+apiKey: "VLLM_API_KEY",
274+api: "openai-completions",
275+models: [],
276+},
277+},
278+},
279+},
280+);
281+282+expect(auth("vllm")).toEqual({
283+apiKey: undefined,
284+discoveryApiKey: undefined,
285+});
286+});
287+288+it("preserves bare all-caps configured api keys as literal catalog discovery keys", () => {
289+const auth = createProviderApiKeyResolver(
290+{} as NodeJS.ProcessEnv,
291+{
292+version: 1,
293+profiles: {},
294+},
295+{
296+models: {
297+providers: {
298+vllm: {
299+baseUrl: "http://127.0.0.1:8000/v1",
300+apiKey: "ALLCAPS_SAMPLE",
301+api: "openai-completions",
302+models: [],
303+},
304+},
305+},
306+},
307+);
308+309+expect(auth("vllm")).toEqual({
310+apiKey: "ALLCAPS_SAMPLE",
311+discoveryApiKey: "ALLCAPS_SAMPLE",
312+});
313+});
314+258315it("preserves shared non-secret synthetic auth markers from provider hooks", () => {
259316mockedResolveProviderSyntheticAuthWithPlugin.mockReturnValue({
260317apiKey: CUSTOM_LOCAL_AUTH_MARKER,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。