mirror of
https://github.com/Heretek-AI/opencode.git
synced 2026-11-07 10:56:09 -10:00
refactor(console): hardcode anonymous proxy models
This commit is contained in:
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(() => {})
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user