mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-14 03:56:55 +03:00
refactor(console): proxy every keyless free Zen model to new inference (#53967)
This commit is contained in:
committed by
GitHub
Unverified
parent
9c1fdf8f7c
commit
687664c63b
@@ -57,22 +57,6 @@ 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([
|
||||
"big-pickle",
|
||||
"fledge-alpha-free",
|
||||
"jev-1.13-free",
|
||||
"ling-3.0-flash-fin-free",
|
||||
"ling-3.1-flash-free",
|
||||
"longcat-2.5-preview-free",
|
||||
"mimo-v2.6-flash-free",
|
||||
"muse-spark-1.2-contributor-free",
|
||||
"muse-spark-1.3-contributor-free",
|
||||
"nemotron-3-ultra-free",
|
||||
"nemotron-3.5-lightning-free",
|
||||
"space-bunny-free",
|
||||
])
|
||||
|
||||
function resolve(text: string, params?: Record<string, string | number>) {
|
||||
if (!params) return text
|
||||
return text.replace(/\{\{(\w+)\}\}/g, (raw, key) => {
|
||||
@@ -131,7 +115,8 @@ export async function handler(
|
||||
opts.modelList === "full"
|
||||
? entry?.providers.find((provider) => provider.id === entry.byokProvider)?.model
|
||||
: undefined,
|
||||
anonymous: opts.modelList === "full" && ANONYMOUS_PROXY_MODELS.has(model),
|
||||
// Keyless requests for free models skip legacy checks and go straight to new inference.
|
||||
anonymous: opts.modelList === "full" && entry?.allowAnonymous === true,
|
||||
body: (providerModel) => requestBody?.stream(providerModel ?? model, false) ?? body,
|
||||
}).catch(() => {
|
||||
void (requestBody ? requestBody.cancel() : body.cancel()).catch(() => {})
|
||||
|
||||
Reference in New Issue
Block a user