Gemini Relay

API guide

Deploy · env · endpoints

Request & response

Body and response match the official Gemini REST API. Paths: /api/v1, /api/v1beta, /api/v1beta2.

GET/api/v1beta/models

List models — no body.

curl "https://gemini-relay-proxy.vercel.app/api/v1beta/models" -H "X-API-KEY: <secret>"
POST/api/v1beta/models/{model}:generateContent

Body: JSON contents. Response: candidates / usageMetadata (same as Google).

curl "https://gemini-relay-proxy.vercel.app/api/v1beta/models/gemini-2.5-flash:generateContent" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: <secret>" \
  --data-raw '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}]}'
POST/api/v1beta/models/{model}:streamGenerateContent

Same body as generateContent. Response: streamed chunks.

curl "https://gemini-relay-proxy.vercel.app/api/v1beta/models/gemini-2.5-flash:streamGenerateContent" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: <secret>" \
  --data-raw '{"contents":[{"role":"user","parts":[{"text":"Hello"}]}]}'
401Missing or invalid credential
503Proxy headers OK but GEMINI_API_KEYS unset; or MCP without PROXY_AUTH_HEADERS
403Empty body on POST / PUT / PATCH

Full field reference: Google Gemini API docs. Auth examples below use proxy headers — swap for passthrough (?key= / x-goog-api-key) as needed.

Request & response · Gemini Relay