fix: increase timeout for z.ai provider to handle slow API spikes (#379) (#396)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
TÂCHES 2026-03-14 13:34:47 -06:00 committed by GitHub
parent 07609d50b7
commit 4dcbff0c06

View file

@ -357,11 +357,14 @@ function createClient(
Object.assign(headers, optionsHeaders);
}
const isZai = model.provider === "zai" || model.baseUrl.includes("api.z.ai");
return new OpenAI({
apiKey,
baseURL: model.baseUrl,
dangerouslyAllowBrowser: true,
defaultHeaders: headers,
...(isZai && { timeout: 100_000, maxRetries: 4 }),
});
}