chore: improve variant parsing for zen

This commit is contained in:
vimtor
2026-05-07 20:38:14 +02:00
parent 2c17e3a4db
commit cc6dd5321c
7 changed files with 33 additions and 6 deletions
@@ -0,0 +1,21 @@
export function parseAnthropicVariant(body: any) {
const effort = body.effort ?? body.output_config?.effort ?? body.outputConfig?.effort ?? body.thinking?.effort
if (effort) return effort
const budget = body.thinking?.budget_tokens ?? body.thinking?.budgetTokens
if (body.thinking?.type !== "enabled" || typeof budget !== "number") return undefined
return budget > 16_000 ? "max" : "high"
}
export function parseGoogleVariant(body: any) {
const thinkingConfig = body.generationConfig?.thinkingConfig ?? body.thinkingConfig
if (thinkingConfig?.thinkingLevel) return thinkingConfig.thinkingLevel
const budget = thinkingConfig?.thinkingBudget ?? thinkingConfig?.thinking_budget
if (typeof budget !== "number" || budget <= 0) return undefined
return budget > 16_000 ? "max" : "high"
}
export function parseOpenAiVariant(body: any) {
return body.reasoningEffort ?? body.reasoning_effort ?? body.reasoning?.effort
}