Update server.js
Browse files
server.js
CHANGED
|
@@ -53,8 +53,9 @@ const PROVIDERS = [
|
|
| 53 |
url: "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions"
|
| 54 |
},
|
| 55 |
{
|
| 56 |
-
|
| 57 |
-
|
|
|
|
| 58 |
}
|
| 59 |
];
|
| 60 |
|
|
@@ -62,7 +63,7 @@ const PROVIDERS = [
|
|
| 62 |
// Ahora el proxy dejará pasar todo el tráfico y el proveedor final aplicará el rate limit por IP.
|
| 63 |
const MAX_PER_PROVIDER = 500;
|
| 64 |
const QUEUE_TIMEOUT = 45000;
|
| 65 |
-
let currentLoad = { "pollinations-ai": 0, "kepler-cloud": 0, "
|
| 66 |
|
| 67 |
// --- RATE LIMITING LOCAL ---
|
| 68 |
const limiter = rateLimit({
|
|
@@ -126,8 +127,8 @@ async function fetchAllModels() {
|
|
| 126 |
allModels = [
|
| 127 |
{ id: "gpt-4o", object: "model", type: "text", owned_by: "pollinations-ai" },
|
| 128 |
{ id: "claude-3-5-sonnet", object: "model", type: "text", owned_by: "pollinations-ai" },
|
| 129 |
-
{ id: "gemini-1.5-pro", object: "model", type: "text", owned_by: "
|
| 130 |
-
{ id: "gemini-1.5-flash", object: "model", type: "text", owned_by: "
|
| 131 |
];
|
| 132 |
}
|
| 133 |
return allModels;
|
|
@@ -222,11 +223,6 @@ app.post(['/v1/chat/completions', '/v1/images/generations'], limiter, async (req
|
|
| 222 |
"X-Forwarded-For": clientIp, // El proveedor rate-limitea esta IP
|
| 223 |
"X-Real-IP": clientIp // El proveedor rate-limitea esta IP
|
| 224 |
};
|
| 225 |
-
|
| 226 |
-
// 🔥 INYECCIÓN DE DUMMY KEY PARA VOIDS-API 🔥
|
| 227 |
-
if (selectedProvider.id === "voids-api") {
|
| 228 |
-
fetchHeaders["Authorization"] = "Bearer sk-dummy-voids-key-12345";
|
| 229 |
-
}
|
| 230 |
|
| 231 |
const response = await fetch(targetUrl, {
|
| 232 |
method: "POST",
|
|
|
|
| 53 |
url: "https://oai.endpoints.kepler.ai.cloud.ovh.net/v1/chat/completions"
|
| 54 |
},
|
| 55 |
{
|
| 56 |
+
// Proveedor público alternativo que no pide API Key
|
| 57 |
+
id: "churchless-api",
|
| 58 |
+
url: "https://free.churchless.tech/v1/chat/completions"
|
| 59 |
}
|
| 60 |
];
|
| 61 |
|
|
|
|
| 63 |
// Ahora el proxy dejará pasar todo el tráfico y el proveedor final aplicará el rate limit por IP.
|
| 64 |
const MAX_PER_PROVIDER = 500;
|
| 65 |
const QUEUE_TIMEOUT = 45000;
|
| 66 |
+
let currentLoad = { "pollinations-ai": 0, "kepler-cloud": 0, "churchless-api": 0 };
|
| 67 |
|
| 68 |
// --- RATE LIMITING LOCAL ---
|
| 69 |
const limiter = rateLimit({
|
|
|
|
| 127 |
allModels = [
|
| 128 |
{ id: "gpt-4o", object: "model", type: "text", owned_by: "pollinations-ai" },
|
| 129 |
{ id: "claude-3-5-sonnet", object: "model", type: "text", owned_by: "pollinations-ai" },
|
| 130 |
+
{ id: "gemini-1.5-pro", object: "model", type: "text", owned_by: "churchless-api" },
|
| 131 |
+
{ id: "gemini-1.5-flash", object: "model", type: "text", owned_by: "churchless-api" }
|
| 132 |
];
|
| 133 |
}
|
| 134 |
return allModels;
|
|
|
|
| 223 |
"X-Forwarded-For": clientIp, // El proveedor rate-limitea esta IP
|
| 224 |
"X-Real-IP": clientIp // El proveedor rate-limitea esta IP
|
| 225 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 226 |
|
| 227 |
const response = await fetch(targetUrl, {
|
| 228 |
method: "POST",
|