mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix(gemini): support native TTS generateContent endpoint
Pass Gemini AUDIO/TTS generateContent requests through to Google's native v1beta endpoint instead of converting to chat, with per-credential fallback (504 timeout, 502 fetch failure). Accept client keys from Bearer, x-goog-api-key, or ?key= while forwarding only the configured Gemini credential upstream. Expose native v1beta model names and rewrites, and add Gemini 3.1 Flash TTS to the catalogs. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Cursor
parent
1980178d02
commit
dae69a3916
@@ -119,7 +119,11 @@ function isPublicLlmApi(pathname) {
|
||||
function extractApiKey(request) {
|
||||
const authHeader = request.headers.get("Authorization");
|
||||
if (authHeader?.startsWith("Bearer ")) return authHeader.slice(7);
|
||||
return request.headers.get("x-api-key");
|
||||
const apiKeyHeader = request.headers.get("x-api-key");
|
||||
if (apiKeyHeader) return apiKeyHeader;
|
||||
const googleApiKeyHeader = request.headers.get("x-goog-api-key");
|
||||
if (googleApiKeyHeader) return googleApiKeyHeader;
|
||||
return request.nextUrl.searchParams?.get("key") || null;
|
||||
}
|
||||
|
||||
async function hasValidApiKey(request) {
|
||||
|
||||
Reference in New Issue
Block a user