refactor(console): hardcode anonymous proxy models

This commit is contained in:
vimtor committed 2026-10-07 11:44:29 +02:00
1 parent 13ee667465
commit 2f5e178239
2 files changed
+4 -3

No files matched your search

@@ -57,6 +57,9 @@ type ZenData = Awaited<ReturnType<typeof ZenData.list>>
type PreparedBody = Awaited<ReturnType<typeof prepareRequestBody>>
type BillingSource = "anonymous" | "free" | "byok" | "subscription" | "lite" | "balance"
// Free models whose keyless requests skip legacy checks and go straight to new inference.
const ANONYMOUS_PROXY_MODELS = new Set(["ling-3.1-flash-free", "nemotron-3.5-lightning-free"])
function resolve(text: string, params?: Record<string, string | number>) {
if (!params) return text
return text.replace(/\{\{(\w+)\}\}/g, (raw, key) => {
@@ -115,7 +118,7 @@ export async function handler(
opts.modelList === "full"
? entry?.providers.find((provider) => provider.id === entry.byokProvider)?.model
: undefined,
anonymous: opts.modelList === "full" && entry?.proxyAnonymous === true,
anonymous: opts.modelList === "full" && ANONYMOUS_PROXY_MODELS.has(model),
body: (providerModel) => requestBody?.stream(providerModel ?? model, false) ?? body,
}).catch(() => {
void (requestBody ? requestBody.cancel() : body.cancel()).catch(() => {})
-2
View File
@@ -32,8 +32,6 @@ export namespace ZenData {
cost200K: ModelCostTierSchema.optional(),
costPeak: ModelCostSchema.optional(),
allowAnonymous: z.boolean().optional(),
// Sends keyless requests straight to new inference, skipping legacy free-tier checks.
proxyAnonymous: z.boolean().optional(),
byokProvider: z.enum(["openai", "anthropic", "google"]).optional(),
stickyProvider: z.enum(["strict", "prefer"]).optional(),
trialProvider: z.string().optional(),