[UNTESTED] [callmerussell04/gpt-proxy] 1 endpoint(s)
Gemini
API Proxy/Gemini
2,119 characters
Status: [UNTESTED]
Endpoints found:
http://localhost:8080/chat
Source: https://github.com/callmerussell04/gpt-proxy
# GPT Proxy
Two small Go programs:
- `proxy-server`: HTTP proxy to Gemini API.
- `proxy-client`: interactive terminal chat client.
The server keeps `GEMINI_API_KEY`. The client sends only `GPT_PROXY_TOKEN` to the proxy.
## Server
Build a Linux binary for the remote server:
```sh
cd proxy-server
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o proxy-server .
```
Copy it to the server:
```sh
scp proxy-server user@your-server:/opt/gpt-proxy/proxy-server
```
Run it on the server:
```sh
GEMINI_API_KEY='your-gemini-api-key' \
GPT_PROXY_TOKEN='your-proxy-password' \
GEMINI_MODEL='gemini-2.5-flash-lite' \
/opt/gpt-proxy/proxy-server
```
Optional env:
- `ADDR=:8080`
- `GEMINI_MODEL=gemini-2.5-flash-lite`
- `GEMINI_BASE_URL=https://generativelanguage.googleapis.com/v1beta`
- `MAX_CHAT_REQUEST_BYTES=33554432` default request limit for `/chat` bodies, 32 MiB.
Create the Gemini API key in Google AI Studio. Free Tier availability and limits depend on the selected model and your Google account.
Example with the default Free Tier-oriented model:
```sh
GEMINI_API_KEY='your-gemini-api-key' \
GPT_PROXY_TOKEN='your-proxy-password' \
/opt/gpt-proxy/proxy-server
```
Health check does not require auth:
```sh
curl http://localhost:8080/health
```
Chat requests require auth:
```sh
curl -X POST http://localhost:8080/chat \
-H "Authorization: Bearer $GPT_PROXY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"messages":[{"role":"user","content":"Hello"}]}'
```
For a public server, put HTTPS in front of this service with a reverse proxy.
## Client Docker
Build the client image locally:
```sh
docker build -t gpt-proxy-client ./proxy-client
```
Run the interactive client:
```sh
docker run --rm -it \
-e GPT_PROXY_URL='https://your-server.example.com' \
-e GPT_PROXY_TOKEN='your-proxy-password' \
-v gpt-proxy-client-data:/data \
gpt-proxy-client
```
If the server is exposed directly without HTTPS during local testing:
```sh
docker run --rm -it \
-e GPT