From 5467136c1af0c8171a844dd9d10ad817fa4658be Mon Sep 17 00:00:00 2001 From: nai-degen Date: Mon, 6 Nov 2023 16:35:35 -0600 Subject: [PATCH] adds gpt4-turbo to userschema; updates docs --- .env.example | 7 +++++-- src/info-page.ts | 14 ++++---------- src/shared/users/schema.ts | 1 + 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/.env.example b/.env.example index 794caa1..f8fe128 100644 --- a/.env.example +++ b/.env.example @@ -15,7 +15,7 @@ # MODEL_RATE_LIMIT=4 # Max number of output tokens a user can request at once. -# MAX_OUTPUT_TOKENS_OPENAI=300 +# MAX_OUTPUT_TOKENS_OPENAI=400 # MAX_OUTPUT_TOKENS_ANTHROPIC=400 # Whether to show the estimated cost of consumed tokens on the info page. @@ -27,7 +27,10 @@ # CHECK_KEYS=true # Which model types users are allowed to access. -# ALLOWED_MODEL_FAMILIES=claude,turbo,gpt4,gpt4-32k +# If you want to restrict access to certain models, uncomment the line below and list only the models you want to allow, +# separated by commas. By default, all models are allowed. The following model families are recognized: +# turbo | gpt4 | gpt4-32k | gpt4-turbo | claude | bison | aws-claude +# ALLOWED_MODEL_FAMILIES=turbo,gpt4-turbo,aws-claude # URLs from which requests will be blocked. # BLOCKED_ORIGINS=reddit.com,9gag.com diff --git a/src/info-page.ts b/src/info-page.ts index 1087478..5a747b3 100644 --- a/src/info-page.ts +++ b/src/info-page.ts @@ -287,18 +287,12 @@ function getOpenAIInfo() { const tokens = modelStats.get(`${f}__tokens`) || 0; const cost = getTokenCostUsd(f, tokens); - const active = modelStats.get(`${f}__active`) || 0; - const trial = modelStats.get(`${f}__trial`) || 0; - const revoked = modelStats.get(`${f}__revoked`) || 0; - const overQuota = modelStats.get(`${f}__overQuota`) || 0; - if (active + trial + revoked + overQuota === 0) return; - info[f] = { usage: `${prettyTokens(tokens)} tokens${getCostString(cost)}`, - activeKeys: active, - trialKeys: trial, - revokedKeys: revoked, - overQuotaKeys: overQuota, + activeKeys: modelStats.get(`${f}__active`) || 0, + trialKeys: modelStats.get(`${f}__trial`) || 0, + revokedKeys: modelStats.get(`${f}__revoked`) || 0, + overQuotaKeys: modelStats.get(`${f}__overQuota`) || 0, }; }); } else { diff --git a/src/shared/users/schema.ts b/src/shared/users/schema.ts index cefcae1..eb9df44 100644 --- a/src/shared/users/schema.ts +++ b/src/shared/users/schema.ts @@ -6,6 +6,7 @@ export const tokenCountsSchema: ZodType = z.object({ turbo: z.number().optional().default(0), gpt4: z.number().optional().default(0), "gpt4-32k": z.number().optional().default(0), + "gpt4-turbo": z.number().optional().default(0), claude: z.number().optional().default(0), bison: z.number().optional().default(0), "aws-claude": z.number().optional().default(0),