Spaces:
Paused
Paused
add gemini worker api
Browse files
Caddyfile
CHANGED
|
@@ -2,9 +2,15 @@
|
|
| 2 |
handle_path /8085/* {
|
| 3 |
reverse_proxy localhost:8085
|
| 4 |
}
|
| 5 |
-
|
| 6 |
-
|
|
|
|
| 7 |
}
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
}
|
|
|
|
| 2 |
handle_path /8085/* {
|
| 3 |
reverse_proxy localhost:8085
|
| 4 |
}
|
| 5 |
+
# https://github.com/justlovemaki/AIClient-2-API
|
| 6 |
+
handle_path /apiv1/* {
|
| 7 |
+
reverse_proxy localhost:3000
|
| 8 |
}
|
| 9 |
+
# https://github.com/waxz/gemini-cli-openai
|
| 10 |
+
handle_path /apiv2/* {
|
| 11 |
+
reverse_proxy localhost:8787
|
| 12 |
+
}
|
| 13 |
+
# gemini balance
|
| 14 |
+
reverse_proxy localhost:8000
|
| 15 |
|
| 16 |
}
|
run.sh
CHANGED
|
@@ -8,6 +8,7 @@ tar -xzf /tmp/caddy.tar.gz -C /tmp/caddy
|
|
| 8 |
|
| 9 |
# Start the Node.js application
|
| 10 |
git clone https://github.com/waxz/Gemini-CLI-2-API.git /tmp/Gemini-CLI-2-API
|
|
|
|
| 11 |
|
| 12 |
git clone https://github.com/snailyp/gemini-balance.git /tmp/gemini-balance
|
| 13 |
|
|
@@ -54,8 +55,8 @@ MYSQL_USER=${MYSQL_USER}
|
|
| 54 |
MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
| 55 |
MYSQL_DATABASE=${MYSQL_DATABASE}
|
| 56 |
API_KEYS=["${GEMINI_API_KEYS}"]
|
| 57 |
-
ALLOWED_TOKENS=["${
|
| 58 |
-
AUTH_TOKEN=${
|
| 59 |
# For Vertex AI Platform API Keys
|
| 60 |
VERTEX_API_KEYS=["AQ.Abxxxxxxxxxxxxxxxxxxx"]
|
| 61 |
# For Vertex AI Platform Express API Base URL
|
|
@@ -139,9 +140,22 @@ FILES_USER_ISOLATION_ENABLED=true
|
|
| 139 |
##########################################################################
|
| 140 |
EOF
|
| 141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
cd /tmp/Gemini-CLI-2-API && npm install && node src/api-server.js &
|
| 143 |
cd /tmp/gemini-balance && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
|
| 144 |
-
|
| 145 |
/tmp/caddy/caddy run --config /Caddyfile &
|
| 146 |
MAIN_PID=$!
|
| 147 |
|
|
|
|
| 8 |
|
| 9 |
# Start the Node.js application
|
| 10 |
git clone https://github.com/waxz/Gemini-CLI-2-API.git /tmp/Gemini-CLI-2-API
|
| 11 |
+
git clone https://github.com/waxz/gemini-cli-openai /tmp/gemini-cli-openai
|
| 12 |
|
| 13 |
git clone https://github.com/snailyp/gemini-balance.git /tmp/gemini-balance
|
| 14 |
|
|
|
|
| 55 |
MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
| 56 |
MYSQL_DATABASE=${MYSQL_DATABASE}
|
| 57 |
API_KEYS=["${GEMINI_API_KEYS}"]
|
| 58 |
+
ALLOWED_TOKENS=["${REQUIRED_API_KEY}"]
|
| 59 |
+
AUTH_TOKEN=${REQUIRED_API_KEY}
|
| 60 |
# For Vertex AI Platform API Keys
|
| 61 |
VERTEX_API_KEYS=["AQ.Abxxxxxxxxxxxxxxxxxxx"]
|
| 62 |
# For Vertex AI Platform Express API Base URL
|
|
|
|
| 140 |
##########################################################################
|
| 141 |
EOF
|
| 142 |
|
| 143 |
+
cat << EOF | tee /tmp/gemini-cli-openai/.dev.vars
|
| 144 |
+
# Required: OAuth2 credentials JSON from Gemini CLI authentication
|
| 145 |
+
GCP_SERVICE_ACCOUNT=${GCP_SERVICE_ACCOUNT}
|
| 146 |
+
# Optional: Google Cloud Project ID (auto-discovered if not set)
|
| 147 |
+
GEMINI_PROJECT_ID=${GEMINI_PROJECT_ID}
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
# Optional: API key for authentication (if not set, API is public)
|
| 151 |
+
# When set, clients must include "Authorization: Bearer <your-api-key>" header
|
| 152 |
+
# Example: sk-1234567890abcdef1234567890abcdef
|
| 153 |
+
OPENAI_API_KEY=${REQUIRED_API_KEY}
|
| 154 |
+
EOF
|
| 155 |
+
|
| 156 |
cd /tmp/Gemini-CLI-2-API && npm install && node src/api-server.js &
|
| 157 |
cd /tmp/gemini-balance && uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload &
|
| 158 |
+
cd /tmp/gemini-cli-openai && npm i && npm run dev &
|
| 159 |
/tmp/caddy/caddy run --config /Caddyfile &
|
| 160 |
MAIN_PID=$!
|
| 161 |
|