diff --git a/app/api/voice/chat/route.ts b/app/api/voice/chat/route.ts index 51bf127..cea0839 100644 --- a/app/api/voice/chat/route.ts +++ b/app/api/voice/chat/route.ts @@ -3,6 +3,7 @@ export const runtime = 'nodejs' import { NextResponse } from 'next/server' import Groq from 'groq-sdk' +import { HttpsProxyAgent } from 'https-proxy-agent' import { voiceBus } from '@/lib/voice-bus' import { systemPrompt } from '@/lib/voice-prompts' @@ -45,7 +46,9 @@ function client(): Groq { if (_client) return _client const apiKey = process.env.GROQ_API_KEY if (!apiKey) throw new Error('GROQ_API_KEY not set') - _client = new Groq({ apiKey }) + const proxyUrl = process.env.GROQ_PROXY + const httpAgent = proxyUrl ? new HttpsProxyAgent(proxyUrl) : undefined + _client = new Groq({ apiKey, httpAgent } as any) return _client }