DV

davidkk/vercel-gemini-proxy

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

16 stars 품질 85 트렌드 41MIT

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.app in 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 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.
    • Passthrough: ?key= or x-goog-api-key with your Gemini key.
    • Proxy mode: 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.js App Router Route Handlers (nodejs + Fluid Compute): app/api/v1|v1beta|v1beta2/[...path] → services/gemini/. Successful calls return 200 then stream. maxDuration and 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) or gemini-3.5-flash-lite (lighter). Playground can Refresh the official model list.
  • Debug via Vercel → Logs (or local pnpm dev terminal). Playground / MCP are for debugging; generation still goes through the REST proxy.

Deploy

  1. Clone / import the repo and deploy.
  2. Attach a custom domain.
GitHub에서 전체 README 보기

추천 도구

다른 키워드를 입력하거나 필터를 제거해 보세요.

설치

npx skillfish add davidkk/vercel-gemini-proxy
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →