unified-ai-router 3.2.4 → 3.2.6
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/.env.example +1 -1
- package/openai-compatible-server/index.js +1 -1
- package/package.json +2 -2
- package/provider.js +21 -2
- package/readme.md +1 -1
- package/bruno/openai/bruno.json +0 -9
- package/bruno/openai/chat.bru +0 -38
- package/bruno/openai/environments/local.bru +0 -3
- package/bruno/openai/environments/openrouter.bru +0 -4
- package/bruno/openai/environments/render.com.bru +0 -3
- package/bruno/openai/models.bru +0 -38
- package/bruno/openai/tools-2.bru +0 -116
- package/bruno/openai/tools.bru +0 -80
package/.env.example
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unified-ai-router",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.6",
|
|
4
4
|
"description": "A unified interface for multiple LLM providers with automatic fallback. This project includes an OpenAI-compatible server and a deployable Telegram bot with a Mini App interface. It supports major providers like OpenAI, Google, Grok, and more, ensuring reliability and flexibility for your AI applications.",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "mlibre",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dotenv": "^17.2.1",
|
|
44
44
|
"eslint": "^9.33.0",
|
|
45
45
|
"express": "^5.1.0",
|
|
46
|
-
"openai": "^
|
|
46
|
+
"openai": "^6.1.0",
|
|
47
47
|
"pino": "^9.9.0",
|
|
48
48
|
"pino-pretty": "^13.1.1"
|
|
49
49
|
}
|
package/provider.js
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
module.exports = [
|
|
2
|
+
{
|
|
3
|
+
name: "gemini",
|
|
4
|
+
apiKey: process.env.GEMINI_API_KEY_2,
|
|
5
|
+
model: "gemini-2.5-pro",
|
|
6
|
+
apiUrl: "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
name: "openrouter",
|
|
4
10
|
apiKey: process.env.OPENROUTER_API_KEY,
|
|
5
11
|
model: "x-ai/grok-4-fast:free",
|
|
6
12
|
apiUrl: "https://openrouter.ai/api/v1",
|
|
7
13
|
},
|
|
14
|
+
{
|
|
15
|
+
name: "cerebras",
|
|
16
|
+
apiKey: process.env.CEREBRAS_API_KEY_2,
|
|
17
|
+
model: "gpt-oss-120b",
|
|
18
|
+
apiUrl: "https://api.cerebras.ai/v1",
|
|
19
|
+
},
|
|
20
|
+
|
|
8
21
|
{
|
|
9
22
|
name: "cerebras",
|
|
10
23
|
apiKey: process.env.CEREBRAS_API_KEY,
|
|
@@ -25,7 +38,7 @@ module.exports = [
|
|
|
25
38
|
},
|
|
26
39
|
{
|
|
27
40
|
name: "google",
|
|
28
|
-
apiKey: process.env.
|
|
41
|
+
apiKey: process.env.GEMINI_API_KEY,
|
|
29
42
|
model: "gemini-2.5-pro",
|
|
30
43
|
apiUrl: "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
31
44
|
},
|
|
@@ -37,7 +50,7 @@ module.exports = [
|
|
|
37
50
|
},
|
|
38
51
|
{
|
|
39
52
|
name: "google",
|
|
40
|
-
apiKey: process.env.
|
|
53
|
+
apiKey: process.env.GEMINI_API_KEY,
|
|
41
54
|
model: "gemini-2.5-flash",
|
|
42
55
|
apiUrl: "https://generativelanguage.googleapis.com/v1beta/openai/",
|
|
43
56
|
},
|
|
@@ -47,6 +60,12 @@ module.exports = [
|
|
|
47
60
|
model: "glm-4.5-flash",
|
|
48
61
|
apiUrl: "https://api.z.ai/api/paas/v4",
|
|
49
62
|
},
|
|
63
|
+
{
|
|
64
|
+
name: "openrouter",
|
|
65
|
+
apiKey: process.env.OPENROUTER_API_KEY_2,
|
|
66
|
+
model: "x-ai/grok-4-fast:free",
|
|
67
|
+
apiUrl: "https://openrouter.ai/api/v1",
|
|
68
|
+
},
|
|
50
69
|
{
|
|
51
70
|
name: "openai",
|
|
52
71
|
apiKey: process.env.OPENAI_API_KEY,
|
package/readme.md
CHANGED
package/bruno/openai/bruno.json
DELETED
package/bruno/openai/chat.bru
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
meta {
|
|
2
|
-
name: chat
|
|
3
|
-
type: http
|
|
4
|
-
seq: 1
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
post {
|
|
8
|
-
url: {{address}}/chat/completions
|
|
9
|
-
body: json
|
|
10
|
-
auth: none
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
headers {
|
|
14
|
-
Content-Type: application/json
|
|
15
|
-
Authorization: {{token}}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
body:json {
|
|
19
|
-
{
|
|
20
|
-
"messages": [
|
|
21
|
-
{
|
|
22
|
-
"role": "system",
|
|
23
|
-
"content": "You are a helpful assistant."
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"role": "user",
|
|
27
|
-
"content": "Hello, say two words only."
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"model": "test",
|
|
31
|
-
"temperature": 0,
|
|
32
|
-
"stream": true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
settings {
|
|
37
|
-
encodeUrl: false
|
|
38
|
-
}
|
package/bruno/openai/models.bru
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
meta {
|
|
2
|
-
name: models
|
|
3
|
-
type: http
|
|
4
|
-
seq: 5
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
get {
|
|
8
|
-
url: {{address}}/models
|
|
9
|
-
body: json
|
|
10
|
-
auth: none
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
headers {
|
|
14
|
-
Content-Type: application/json
|
|
15
|
-
Authorization: {{token}}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
body:json {
|
|
19
|
-
{
|
|
20
|
-
"messages": [
|
|
21
|
-
{
|
|
22
|
-
"role": "system",
|
|
23
|
-
"content": "You are a helpful assistant."
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
"role": "user",
|
|
27
|
-
"content": "Hello, say two words only."
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"model": "x-ai/grok-4-fast:free",
|
|
31
|
-
"temperature": 0,
|
|
32
|
-
"stream": true
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
settings {
|
|
37
|
-
encodeUrl: false
|
|
38
|
-
}
|
package/bruno/openai/tools-2.bru
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
meta {
|
|
2
|
-
name: tools-2
|
|
3
|
-
type: http
|
|
4
|
-
seq: 4
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
post {
|
|
8
|
-
url: {{address}}/chat/completions
|
|
9
|
-
body: json
|
|
10
|
-
auth: none
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
headers {
|
|
14
|
-
Content-Type: application/json
|
|
15
|
-
Authorization: {{token}}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
body:json {
|
|
19
|
-
{
|
|
20
|
-
"model": "x-ai/grok-4-fast:free",
|
|
21
|
-
"messages": [
|
|
22
|
-
{
|
|
23
|
-
"role": "user",
|
|
24
|
-
"content": "What's the weather like in Tehran and Gaza today?"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"role": "assistant",
|
|
28
|
-
"content": "",
|
|
29
|
-
"tool_calls": [
|
|
30
|
-
{
|
|
31
|
-
"id": "call_31531384",
|
|
32
|
-
"function": {
|
|
33
|
-
"name": "get_weather",
|
|
34
|
-
"arguments": "{\"city\":\"Tehran\"}"
|
|
35
|
-
},
|
|
36
|
-
"index": 0,
|
|
37
|
-
"type": "function"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"id": "call_05244223",
|
|
41
|
-
"function": {
|
|
42
|
-
"name": "get_weather",
|
|
43
|
-
"arguments": "{\"city\":\"Gaza\"}"
|
|
44
|
-
},
|
|
45
|
-
"index": 1,
|
|
46
|
-
"type": "function"
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"role": "tool",
|
|
52
|
-
"tool_call_id": "call_31531384",
|
|
53
|
-
"name": "get_weather",
|
|
54
|
-
"content": "{\"temperature\":25,\"condition\":\"sunny\",\"humidity\":40}"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"role": "tool",
|
|
58
|
-
"tool_call_id": "call_05244223",
|
|
59
|
-
"name": "get_weather",
|
|
60
|
-
"content": "{\"temperature\":28,\"condition\":\"clear\",\"humidity\":55}"
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
"tools": [
|
|
64
|
-
{
|
|
65
|
-
"type": "function",
|
|
66
|
-
"function": {
|
|
67
|
-
"name": "get_weather",
|
|
68
|
-
"description": "Get the current weather forecast for a given city.",
|
|
69
|
-
"parameters": {
|
|
70
|
-
"type": "object",
|
|
71
|
-
"properties": {
|
|
72
|
-
"city": {
|
|
73
|
-
"type": "string",
|
|
74
|
-
"description": "The name of the city (e.g., Tehran) to get the weather for."
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"required": [
|
|
78
|
-
"city"
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"type": "function",
|
|
85
|
-
"function": {
|
|
86
|
-
"name": "multiply",
|
|
87
|
-
"description": "Multiply two numbers",
|
|
88
|
-
"parameters": {
|
|
89
|
-
"type": "object",
|
|
90
|
-
"properties": {
|
|
91
|
-
"a": {
|
|
92
|
-
"type": "number",
|
|
93
|
-
"description": "First number"
|
|
94
|
-
},
|
|
95
|
-
"b": {
|
|
96
|
-
"type": "number",
|
|
97
|
-
"description": "Second number"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"required": [
|
|
101
|
-
"a",
|
|
102
|
-
"b"
|
|
103
|
-
]
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
"tool_choice": "auto",
|
|
109
|
-
"stream": false,
|
|
110
|
-
"temperature": 0
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
settings {
|
|
115
|
-
encodeUrl: false
|
|
116
|
-
}
|
package/bruno/openai/tools.bru
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
meta {
|
|
2
|
-
name: tools
|
|
3
|
-
type: http
|
|
4
|
-
seq: 3
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
post {
|
|
8
|
-
url: {{address}}/chat/completions
|
|
9
|
-
body: json
|
|
10
|
-
auth: none
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
headers {
|
|
14
|
-
Content-Type: application/json
|
|
15
|
-
Authorization: {{token}}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
body:json {
|
|
19
|
-
{
|
|
20
|
-
"model": "x-ai/grok-4-fast:free",
|
|
21
|
-
"messages": [
|
|
22
|
-
{
|
|
23
|
-
"role": "user",
|
|
24
|
-
"content": "What's the weather like in Tehran and Gaza today?"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"tools": [
|
|
28
|
-
{
|
|
29
|
-
"type": "function",
|
|
30
|
-
"function": {
|
|
31
|
-
"name": "get_weather",
|
|
32
|
-
"description": "Get the current weather forecast for a given city.",
|
|
33
|
-
"parameters": {
|
|
34
|
-
"type": "object",
|
|
35
|
-
"properties": {
|
|
36
|
-
"city": {
|
|
37
|
-
"type": "string",
|
|
38
|
-
"description": "The name of the city (e.g., Tehran) to get the weather for."
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"required": [
|
|
42
|
-
"city"
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"type": "function",
|
|
49
|
-
"function": {
|
|
50
|
-
"name": "multiply",
|
|
51
|
-
"description": "Multiply two numbers",
|
|
52
|
-
"parameters": {
|
|
53
|
-
"type": "object",
|
|
54
|
-
"properties": {
|
|
55
|
-
"a": {
|
|
56
|
-
"type": "number",
|
|
57
|
-
"description": "First number"
|
|
58
|
-
},
|
|
59
|
-
"b": {
|
|
60
|
-
"type": "number",
|
|
61
|
-
"description": "Second number"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"required": [
|
|
65
|
-
"a",
|
|
66
|
-
"b"
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
],
|
|
72
|
-
"tool_choice": "auto",
|
|
73
|
-
"stream": false,
|
|
74
|
-
"temperature":0
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
settings {
|
|
79
|
-
encodeUrl: false
|
|
80
|
-
}
|