diff --git a/src/proxy/middleware/request/onproxyreq/add-key.ts b/src/proxy/middleware/request/onproxyreq/add-key.ts index 160e8d0..5333496 100644 --- a/src/proxy/middleware/request/onproxyreq/add-key.ts +++ b/src/proxy/middleware/request/onproxyreq/add-key.ts @@ -71,7 +71,7 @@ export const addKey: HPMRequestCallback = (proxyReq, req) => { break; case "openai": const key: OpenAIKey = assignedKey as OpenAIKey; - if (key.organizationId) { + if (key.organizationId && !key.key.includes("svcacct")) { proxyReq.setHeader("OpenAI-Organization", key.organizationId); } proxyReq.setHeader("Authorization", `Bearer ${assignedKey.key}`); diff --git a/src/proxy/openai-image.ts b/src/proxy/openai-image.ts index a1fab53..aed15cc 100644 --- a/src/proxy/openai-image.ts +++ b/src/proxy/openai-image.ts @@ -26,7 +26,7 @@ const handleModelRequest: RequestHandler = (_req, res) => { if (new Date().getTime() - modelListValid < 1000 * 60) { return res.status(200).json(modelListCache); } - const result = generateModelList().filter((m: { id: string }) => + const result = generateModelList("openai").filter((m: { id: string }) => KNOWN_MODELS.includes(m.id) ); modelListCache = { object: "list", data: result }; diff --git a/src/shared/key-management/openai/provider.ts b/src/shared/key-management/openai/provider.ts index 27176b1..a5a3bf8 100644 --- a/src/shared/key-management/openai/provider.ts +++ b/src/shared/key-management/openai/provider.ts @@ -343,6 +343,7 @@ export class OpenAIKeyProvider implements KeyProvider { key.rateLimitedAt = Date.now(); key.rateLimitRequestsReset = KEY_REUSE_DELAY; + key.rateLimitedUntil = Date.now() + KEY_REUSE_DELAY; } }