
davidkk/vercel-gemini-proxy
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
Gemini API proxy on Vercel Edge.
Обзор
is a Gemini API proxy on Vercel (Next.js App Router) for regions where direct Gemini access is slow or blocked, plus a browser streaming playground for debugging. gemini-relay-proxy.vercel.app/chat (demo only) - Prefer DNS in a region that can reach Google Gemini. Do not rely on *.vercel.app in production. If needed, front the service with a jump host or another edge proxy (e.g. CF). - Use Gemini API key. Do not share or reuse others’ keys. - Multiturn messages must end with role: user (or a function response). If the first message is not user, the proxy drops it; if the last is not user, the request is rejected. - Auth paths: /api/v1, /api/v1beta, /api/v1beta2 only. - ?key= or x-goog-api-key with your Gemini key. - headers from PROXY_AUTH_HEADERS; server injects a key from GEMINI_API_KEYS. - Missing credential/path → 401. Proxy mode without GEMINI_API_KEYS → 503. Empty JSON body on POST/PUT/PATCH → 403 (GET needs no body). - Runs on Next.
README
Показан фрагмент оригинального README. Открыть оригинал.
Gemini Relay
Gemini Relay is a Gemini API proxy on Vercel (Next.js App Router) for regions where direct Gemini access is slow or blocked, plus a browser streaming playground for debugging.
Try it: gemini-relay-proxy.vercel.app/chat (demo only)
Important notes
- Custom domain required for production. Prefer DNS in a region that can reach Google Gemini. Do not rely on
*.vercel.appin production. If needed, front the service with a jump host or another edge proxy (e.g. CF). - Use your own Gemini API key. Do not share or reuse others’ keys.
- Multiturn messages must end with
role: user(or a function response). If the first message is notuser, the proxy drops it; if the last is notuser, the request is rejected. - Auth paths:
/api/v1,/api/v1beta,/api/v1beta2only.- Passthrough:
?key=orx-goog-api-keywith your Gemini key. - Proxy mode: headers from
PROXY_AUTH_HEADERS; server injects a key fromGEMINI_API_KEYS. - Missing credential/path →
401. Proxy mode withoutGEMINI_API_KEYS→503. Empty JSON body on POST/PUT/PATCH →403(GET needs no body).
- Passthrough:
- Runs on Next.js App Router Route Handlers (
nodejs+ Fluid Compute):app/api/v1|v1beta|v1beta2/[...path]→services/gemini/. Successful calls return200then stream.maxDurationand business timeout are 120s. - Model IDs live in the URL (transparent forward), e.g.
/api/v1beta/models/{model}:generateContent. Prefer current Stable:gemini-3.5-flash(general) orgemini-3.5-flash-lite(lighter). Playground can Refresh the official model list. - Debug via Vercel → Logs (or local
pnpm devterminal). Playground / MCP are for debugging; generation still goes through the REST proxy.
Deploy
- Clone / import the repo and deploy.
- Attach a custom domain.
Рекомендуемые инструменты
Попробуйте другой запрос или уберите фильтр.
Установка
npx skillfish add davidkk/vercel-gemini-proxy