refactor: hardcode model validation token budget

This commit is contained in:
chaochaoweb3
2026-07-20 17:08:10 +08:00
parent eb2fa69f58
commit 42ab388118
9 changed files with 2 additions and 110 deletions
+2 -7
View File
@@ -15,7 +15,6 @@ import {
isAihubmixStandardBaseURL,
normalizeMiniMaxBaseURL,
} from "@/lib/ai-providers"
import { resolveModelValidationMaxTokens } from "@/lib/model-validation"
import { allowPrivateUrls, isPrivateUrl } from "@/lib/ssrf-protection"
import { PROVIDER_INFO, type ProviderName } from "@/lib/types/model-config"
@@ -48,10 +47,6 @@ export async function POST(req: Request) {
// Note: Express Mode only needs vertexApiKey
vertexApiKey,
} = body
const validationMaxTokens = resolveModelValidationMaxTokens(
process.env.MODEL_VALIDATION_MAX_TOKENS,
)
if (!provider || !modelId) {
return NextResponse.json(
{ valid: false, error: "Provider and model ID are required" },
@@ -303,7 +298,7 @@ export async function POST(req: Request) {
messages: [
{ role: "user", content: "Say 'OK'" },
],
max_tokens: validationMaxTokens,
max_tokens: 1000,
stream: true,
enable_thinking: false,
}),
@@ -417,7 +412,7 @@ export async function POST(req: Request) {
await generateText({
model,
prompt: "Say 'OK'",
maxOutputTokens: validationMaxTokens,
maxOutputTokens: 1000,
})
const responseTime = Date.now() - startTime