Skip to content

Commit f8cfb69

Browse files
committed
zen: restrict alpha models to admin workspaces
1 parent c6d8e76 commit f8cfb69

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • packages/console/app/src/routes/zen/util

packages/console/app/src/routes/zen/util/handler.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { createDataDumper } from "./dataDumper"
3434
import { createTrialLimiter } from "./trialLimiter"
3535
import { createStickyTracker } from "./stickyProviderTracker"
3636
import { LiteData } from "@opencode-ai/console-core/lite.js"
37+
import { Resource } from "@opencode-ai/console-resource"
3738

3839
type ZenData = Awaited<ReturnType<typeof ZenData.list>>
3940
type RetryOptions = {
@@ -59,7 +60,7 @@ export async function handler(
5960

6061
const MAX_FAILOVER_RETRIES = 3
6162
const MAX_429_RETRIES = 3
62-
const FREE_WORKSPACES = [
63+
const ADMIN_WORKSPACES = [
6364
"wrk_01K46JDFR0E75SG2Q8K172KF3Y", // frank
6465
"wrk_01K6W1A3VE0KMNVSCQT43BG2SX", // opencode bench
6566
]
@@ -520,6 +521,13 @@ export async function handler(
520521
)
521522

522523
if (!data) throw new AuthError("Invalid API key.")
524+
if (
525+
modelInfo.id.startsWith("alpha-") &&
526+
Resource.App.stage === "production" &&
527+
!ADMIN_WORKSPACES.includes(data.workspaceID)
528+
)
529+
throw new AuthError(`Model ${modelInfo.id} not supported`)
530+
523531
logger.metric({
524532
api_key: data.apiKey,
525533
workspace: data.workspaceID,
@@ -546,7 +554,7 @@ export async function handler(
546554
black: data.black,
547555
lite: data.lite,
548556
provider: data.provider,
549-
isFree: FREE_WORKSPACES.includes(data.workspaceID),
557+
isFree: ADMIN_WORKSPACES.includes(data.workspaceID),
550558
isDisabled: !!data.timeDisabled,
551559
}
552560
}

0 commit comments

Comments
 (0)