freegate 0.6.0 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/README.ru.md +2 -2
- package/package.json +2 -2
- package/server.js +23 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Freegate
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Artur21101965/davil-cod/actions)
|
|
4
|
-
[](https://hub.docker.com/r/nik951751/freegate)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://www.npmjs.com/package/davil-cod)
|
|
7
7
|
[](https://github.com/Artur21101965/davil-cod)
|
|
@@ -53,7 +53,7 @@ docker run -d --name davil-cod -p 4000:4000 \
|
|
|
53
53
|
-e PROVIDER_GROQ_APIKEY=... \
|
|
54
54
|
-e PROVIDER_MISTRAL_APIKEY=... \
|
|
55
55
|
-e AUTH=your-secret-key \
|
|
56
|
-
nik951751/
|
|
56
|
+
nik951751/freegate
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Connect any OpenAI client
|
package/README.ru.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Freegate
|
|
2
2
|
|
|
3
3
|
[](https://github.com/Artur21101965/davil-cod/actions)
|
|
4
|
-
[](https://hub.docker.com/r/nik951751/freegate)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
[](https://www.npmjs.com/package/davil-cod)
|
|
7
7
|
|
|
@@ -52,7 +52,7 @@ docker run -d --name davil-cod -p 4000:4000 \
|
|
|
52
52
|
-e PROVIDER_GROQ_APIKEY=... \
|
|
53
53
|
-e PROVIDER_MISTRAL_APIKEY=... \
|
|
54
54
|
-e AUTH=your-secret-key \
|
|
55
|
-
nik951751/
|
|
55
|
+
nik951751/freegate
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
### Подключение к любому OpenAI-клиенту
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "freegate",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Free multi-provider LLM gateway with automatic failover. One OpenAI-compatible endpoint routes to 25 free models (Groq, Mistral, Gemini, NIM, OpenRouter, ZAI, Cerebras, DeepSeek). Never pay for LLMs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"README.md",
|
|
41
41
|
"README.ru.md"
|
|
42
42
|
]
|
|
43
|
-
}
|
|
43
|
+
}
|
package/server.js
CHANGED
|
@@ -130,10 +130,22 @@ async function handleChatCompletion(req, res, body) {
|
|
|
130
130
|
// text as context — so a coding model handles the fix, not vision.
|
|
131
131
|
const hasImage = Array.isArray(body.messages) && body.messages.some((m) => {
|
|
132
132
|
if (Array.isArray(m.content)) {
|
|
133
|
-
return m.content.some((c) => c && (c.type === 'image_url' || c.type === 'image'));
|
|
133
|
+
return m.content.some((c) => c && (c.type === 'image_url' || c.type === 'image' || c.type === 'file' || c.type === 'input_image'));
|
|
134
134
|
}
|
|
135
135
|
return false;
|
|
136
136
|
});
|
|
137
|
+
// Debug: log raw message keys if any mention image/attachment/file
|
|
138
|
+
if (!hasImage && Array.isArray(body.messages)) {
|
|
139
|
+
for (const m of body.messages) {
|
|
140
|
+
if (m && typeof m === 'object' && (m.image || m.attachments || m.file || (Array.isArray(m.content) && m.content.some(c => c && c.image)))) {
|
|
141
|
+
logger.info('Vision debug: обнаружено изображение в другом формате', {
|
|
142
|
+
keys: Object.keys(m).slice(0, 8),
|
|
143
|
+
contentTypes: Array.isArray(m.content) ? m.content.map(c => c && c.type) : null,
|
|
144
|
+
});
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
137
149
|
if (hasImage) {
|
|
138
150
|
// Two-stage pipeline: try vision providers in order until one extracts text.
|
|
139
151
|
const visionChain = ['gemini-vision', 'nim-vision', 'deepseek-vision']
|
|
@@ -530,7 +542,16 @@ const server = http.createServer(async (req, res) => {
|
|
|
530
542
|
}
|
|
531
543
|
|
|
532
544
|
if (parsedUrl.pathname === '/v1/models') {
|
|
533
|
-
const models = Object.entries(PROVIDERS)
|
|
545
|
+
const models = Object.entries(PROVIDERS)
|
|
546
|
+
.filter(([_, p]) => p.enabled)
|
|
547
|
+
.map(([key, p]) => ({
|
|
548
|
+
id: p.model,
|
|
549
|
+
object: 'model',
|
|
550
|
+
owned_by: key,
|
|
551
|
+
category: p.category || 'general',
|
|
552
|
+
vision: p.vision === true,
|
|
553
|
+
latency_ms: getHealth()[key]?.latency || null,
|
|
554
|
+
}));
|
|
534
555
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
535
556
|
res.end(JSON.stringify({ object: 'list', data: models }));
|
|
536
557
|
return;
|