https://github.com/spectre-pro/gemini-vpn
2.3K
This project provides a simple Node.js proxy server for the Google Generative Language API (Gemini API). It allows you to route your API requests through a local proxy, which can be useful for various purposes such as debugging, logging, or bypassing certain network restrictions.
https://generativelanguage.googleapis.com.Host header).You can pull the pre-built Docker image from Docker Hub:
docker pull spectrpro/gemini-vpn
After pulling, you can run the proxy server:
docker run -d -p 34562:34562 --name gemini-vpn spectrpro/gemini-vpn
The proxy will be accessible at http://localhost:34562.
If you prefer to build the Docker image yourself:
git clone https://github.com/spectre-pro/gemini-vpn.git
cd gemini-vpn
docker build -t spectrpro/gemini-vpn .
docker run -d -p 34562:34562 --name gemini-vpn spectrpro/gemini-vpn
git clone https://github.com/spectre-pro/gemini-vpn.git
cd gemini-vpn
npm install
node src/main.js
http://localhost:34562 by default.The proxy server can be configured using environment variables:
PORT: The port on which the proxy server will listen. Defaults to 34562.
PORT=8080 node src/main.jsTARGET_API_URL: The base URL of the target API. Defaults to https://generativelanguage.googleapis.com.
TARGET_API_URL=https://api.example.com node src/main.jsOnce the proxy is running, you can direct your Gemini API requests to http://localhost:34562 instead of https://generativelanguage.googleapis.com.
For example, if you would normally make a request like this:
POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
Content-Type: application/json
{
"contents": [
{
"parts": [
{"text": "Hello, Gemini!"}
]
}
]
}
You would now make it to your proxy:
POST http://localhost:34562/v1beta/models/gemini-pro:generateContent
Content-Type: application/json
{
"contents": [
{
"parts": [
{"text": "Hello, Gemini!"}
]
}
]
}
The proxy will forward this request to https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent and return the response.
This project is licensed under the LICENSE file.
此專案提供一個簡單的 Node.js 代理伺服器,用於 Google Generative Language API (Gemini API)。它允許您透過本地代理路由您的 API 請求,這對於偵錯、日誌記錄或繞過某些網路限制等各種目的都非常有用。
https://generativelanguage.googleapis.com。Host 標頭)。您可以從 Docker Hub 拉取預建的 Docker 映像:
docker pull spectrpro/gemini-vpn
拉取後,您可以運行代理伺服器:
docker run -d -p 34562:34562 --name gemini-vpn spectrpro/gemini-vpn
代理伺服器將在 http://localhost:34562 上可訪問。
如果您更喜歡自己建置 Docker 映像:
git clone https://github.com/spectre-pro/gemini-vpn.git
cd gemini-vpn
docker build -t spectrpro/gemini-vpn .
docker run -d -p 34562:34562 --name gemini-vpn spectrpro/gemini-vpn
git clone https://github.com/spectre-pro/gemini-vpn.git
cd gemini-vpn
npm install
node src/main.js
http://localhost:34562 上運行。代理伺服器可以使用環境變數進行配置:
PORT: 代理伺服器將監聽的埠號。預設為 34562。
PORT=8080 node src/main.jsTARGET_API_URL: 目標 API 的基本 URL。預設為 https://generativelanguage.googleapis.com。
TARGET_API_URL=https://api.example.com node src/main.js代理伺服器運行後,您可以將 Gemini API 請求導向 http://localhost:34562,而不是 https://generativelanguage.googleapis.com。
例如,如果您通常會發出這樣的請求:
POST https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
Content-Type: application/json
{
"contents": [
{
"parts": [
{"text": "Hello, Gemini!"}
]
}
]
}
您現在將其發送到您的代理:
POST http://localhost:34562/v1beta/models/gemini-pro:generateContent
Content-Type: application/json
{
"contents": [
{
"parts": [
{"text": "Hello, Gemini!"}
]
}
]
}
代理伺服器會將此請求轉發到 https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent 並返回回應。
此專案根據 LICENSE 文件獲得許可。
Content type
Image
Digest
sha256:6424a9e14…
Size
58.6 MB
Last updated
about 1 year ago
docker pull spectrpro/gemini-vpn