unified-ai-router 3.0.0 โ†’ 3.0.1

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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/readme.md +76 -70
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unified-ai-router",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
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",
@@ -55,4 +55,4 @@
55
55
  "devDependencies": {
56
56
  "vercel": "^45.0.9"
57
57
  }
58
- }
58
+ }
package/readme.md CHANGED
@@ -1,31 +1,37 @@
1
1
  # Unified AI Router
2
2
 
3
- 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.
4
-
5
- * [๐Ÿš€ Features](#-features)
6
- * [๐Ÿ› ๏ธ Installation](#๏ธ-installation)
7
- * [๐Ÿ“– Usage](#-usage)
8
- * [๐Ÿ“š Basic Library Usage](#-basic-library-usage)
9
- * [๐Ÿค– OpenAI-Compatible Server](#-openai-compatible-server)
10
- * [๐Ÿงช Testing](#-testing)
11
- * [๐Ÿ”ง Supported Providers](#-supported-providers)
12
- * [๐Ÿ”‘ API Keys](#-api-keys)
13
- * [๐Ÿ”ผ Vercel Deployment (Telegram Bot)](#-vercel-deployment-telegram-bot)
14
- * [๐Ÿ“‹ Prerequisites](#-prerequisites)
15
- * [๐Ÿš€ Deployment Steps](#-deployment-steps)
16
- * [๐Ÿ“ฑ Enable Telegram Mini App](#-enable-telegram-mini-app)
17
- * [๐Ÿ“ Project Structure](#-project-structure)
18
- * [๐Ÿ“„ License](#-license)
3
+ Unified AI Router is a comprehensive toolkit for AI applications, featuring:
4
+
5
+ - A unified interface for multiple LLM providers with automatic fallback (the core router library)
6
+ - An OpenAI-compatible server for seamless API integration
7
+ - A deployable Telegram bot with Mini App interface
8
+
9
+ It supports major providers like OpenAI, Google, Grok, and more, ensuring reliability and flexibility.
10
+
11
+ - [๐Ÿš€ Features](#-features)
12
+ - [๐Ÿ› ๏ธ Installation](#๏ธ-installation)
13
+ - [๐Ÿ“– Usage](#-usage)
14
+ - [๐Ÿ“š Basic Library Usage](#-basic-library-usage)
15
+ - [๐Ÿ”Œ OpenAI-Compatible Server](#-openai-compatible-server)
16
+ - [๐Ÿงช Testing](#-testing)
17
+ - [๐Ÿ”ง Supported Providers](#-supported-providers)
18
+ - [๐Ÿ”‘ API Keys](#-api-keys)
19
+ - [๐Ÿ”ผ Vercel Deployment (Telegram Bot)](#-vercel-deployment-telegram-bot)
20
+ - [๐Ÿ“‹ Prerequisites](#-prerequisites)
21
+ - [๐Ÿš€ Deployment Steps](#-deployment-steps)
22
+ - [๐Ÿ“ฑ Enable Telegram Mini App](#-enable-telegram-mini-app)
23
+ - [๐Ÿ“ Project Structure](#-project-structure)
24
+ - [๐Ÿ“„ License](#-license)
19
25
 
20
26
  ## ๐Ÿš€ Features
21
27
 
22
- * **Multi-Provider Support**: Works with OpenAI, Google, Grok, OpenRouter, Z.ai, Qroq, Cohere, Vercel, Cerebras, and LLM7
23
- * **Automatic Fallback**: If one provider fails, automatically tries the next
24
- * **Simple API**: Easy to use interface for all supported providers
25
- * **OpenAI-Compatible Server**: Drop-in replacement for OpenAI API
26
- * **Streaming and Non-Streaming**: Supports both streaming and non-streaming responses
27
- * **Tool Support**: Use tools with your LLM calls
28
- * **Telegram Bot**: Deployable as a Telegram bot with a Mini App interface
28
+ - **Multi-Provider Support**: Works with OpenAI, Google, Grok, OpenRouter, Z.ai, Qroq, Cohere, Vercel, Cerebras, and LLM7
29
+ - **Automatic Fallback**: If one provider fails, automatically tries the next
30
+ - **Simple API**: Easy-to-use interface for all supported providers
31
+ - **OpenAI-Compatible Server**: Drop-in replacement for the OpenAI API, enabling easy integration with existing tools and clients
32
+ - **Streaming and Non-Streaming Support**: Handles both streaming and non-streaming responses
33
+ - **Tool Calling**: Full support for tools in LLM interactions
34
+ - **Telegram Bot Integration**: Deployable as a Telegram bot with an interactive Mini App interface
29
35
 
30
36
  ## ๐Ÿ› ๏ธ Installation
31
37
 
@@ -76,17 +82,17 @@ const response = await llm.chatCompletion(messages, {
76
82
  console.log(response);
77
83
  ```
78
84
 
79
- ### ๐Ÿค– OpenAI-Compatible Server
85
+ ### ๐Ÿ”Œ OpenAI-Compatible Server
80
86
 
81
- The project includes an OpenAI-compatible server that can be used as a drop-in replacement for the OpenAI API.
87
+ The OpenAI-compatible server provides a drop-in replacement for the OpenAI API. It routes requests through the unified router with fallback logic, ensuring high availability.
82
88
 
83
- To start the server, run:
89
+ To start the server locally, run:
84
90
 
85
91
  ```bash
86
92
  npm start
87
93
  ```
88
94
 
89
- The server will be available at `http://localhost:3000/v1/chat/completions`.
95
+ The server listens at `http://localhost:3000/v1/chat/completions` and supports standard OpenAI endpoints like `/v1/chat/completions`.
90
96
 
91
97
  ### ๐Ÿงช Testing
92
98
 
@@ -108,32 +114,32 @@ node tests/tools.js
108
114
 
109
115
  ## ๐Ÿ”ง Supported Providers
110
116
 
111
- * OpenAI
112
- * Google Gemini
113
- * Grok
114
- * OpenRouter
115
- * Z.ai
116
- * Qroq
117
- * Cohere
118
- * Vercel
119
- * Cerebras
120
- * LLM7
117
+ - OpenAI
118
+ - Google Gemini
119
+ - Grok
120
+ - OpenRouter
121
+ - Z.ai
122
+ - Qroq
123
+ - Cohere
124
+ - Vercel
125
+ - Cerebras
126
+ - LLM7
121
127
 
122
128
  ## ๐Ÿ”‘ API Keys
123
129
 
124
130
  Get your API keys from the following providers:
125
131
 
126
- * **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
127
- * **Google Gemini**: [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)
128
- * **Grok**: [console.x.ai](https://console.x.ai/)
129
- * **OpenRouter**: [openrouter.ai/keys](https://openrouter.ai/keys)
130
- * **Z.ai**: [api.z.ai](https://api.z.ai)
131
- * **Qroq**: [console.groq.com/keys](https://console.groq.com/keys)
132
- * **Cohere**: [dashboard.cohere.com/api-keys](https://dashboard.cohere.com/api-keys)
133
- * **Vercel**: [vercel.com/docs/ai/ai-gateway](https://vercel.com/masoud-ghorbanzadehs-projects/~/ai/api-keys)
134
- * **Cerebras**: [cloud.cerebras.ai](https://cloud.cerebras.ai)
135
- * **LLM7**: [token.llm7.io](https://token.llm7.io/)
136
- * Seems like it does not support tool calling
132
+ - **OpenAI**: [platform.openai.com/api-keys](https://platform.openai.com/api-keys)
133
+ - **Google Gemini**: [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey)
134
+ - **Grok**: [console.x.ai](https://console.x.ai/)
135
+ - **OpenRouter**: [openrouter.ai/keys](https://openrouter.ai/keys)
136
+ - **Z.ai**: [api.z.ai](https://api.z.ai)
137
+ - **Qroq**: [console.groq.com/keys](https://console.groq.com/keys)
138
+ - **Cohere**: [dashboard.cohere.com/api-keys](https://dashboard.cohere.com/api-keys)
139
+ - **Vercel AI Gateway**: [vercel.com/docs/ai/ai-gateway](https://vercel.com/docs/ai-gateway)
140
+ - **Cerebras**: [cloud.cerebras.ai](https://cloud.cerebras.ai)
141
+ - **LLM7**: [token.llm7.io](https://token.llm7.io/)
142
+ - Seems like it does not support tool calling
137
143
 
138
144
  ## ๐Ÿ”ผ Vercel Deployment (Telegram Bot)
139
145
 
@@ -141,9 +147,9 @@ This section describes how to deploy the AIRouter as a Telegram bot using Vercel
141
147
 
142
148
  ### ๐Ÿ“‹ Prerequisites
143
149
 
144
- * A Telegram Bot Token (@BotFather)
145
- * API keys for various AI providers
146
- * Vercel account
150
+ - A Telegram Bot Token (@BotFather)
151
+ - API keys for various AI providers
152
+ - Vercel account
147
153
 
148
154
  ### ๐Ÿš€ Deployment Steps
149
155
 
@@ -196,16 +202,16 @@ curl "https://ai-router-flame.vercel.app/api?register_webhook=true"
196
202
  After deploying the bot, you need to configure the Telegram Mini App and menu button:
197
203
 
198
204
  1. **Configure Mini App:**
199
- * Go to [@BotFather](https://t.me/botfather)
200
- * Send `/mybots` and select your bot
201
- * Go to `Bot Settings` โ†’ `Configure Mini App`
202
- * Set the Mini App URL to: `https://ai-router-flame.vercel.app`
205
+ - Go to [@BotFather](https://t.me/botfather)
206
+ - Send `/mybots` and select your bot
207
+ - Go to `Bot Settings` โ†’ `Configure Mini App`
208
+ - Set the Mini App URL to: `https://ai-router-flame.vercel.app`
203
209
 
204
210
  2. **Configure Menu Button:**
205
- * Go to [@BotFather](https://t.me/botfather)
206
- * Send `/mybots` and select your bot
207
- * Go to `Bot Settings` โ†’ `Menu Button`
208
- * Ensure the URL shown is: `https://ai-router-flame.vercel.app`
211
+ - Go to [@BotFather](https://t.me/botfather)
212
+ - Send `/mybots` and select your bot
213
+ - Go to `Bot Settings` โ†’ `Menu Button`
214
+ - Ensure the URL shown is: `https://ai-router-flame.vercel.app`
209
215
 
210
216
  Once configured, users can access the Mini App by sending `/start` or `/app` to your bot, or through the menu button.
211
217
 
@@ -213,17 +219,17 @@ An example of a deployed bot is accessible on Telegram: [https://t.me/freePulseA
213
219
 
214
220
  ## ๐Ÿ“ Project Structure
215
221
 
216
- * `main.js` - The core AIRouter library.
217
- * `provider.js` - A list of supported AI providers.
218
- * `openai-compatible-server/index.js` - An OpenAI-compatible server.
219
- * `tests/` - A suite of tests for the library and server.
220
- * `bruno/` - A Bruno collection for API testing.
221
- * `vercel-project/` - A Vercel project for deploying a Telegram bot.
222
- * `api/index.js` - Main webhook handler for the Telegram bot.
223
- * `api/search.js` - A search proxy for the Telegram bot.
224
- * `public/` - The frontend for the Telegram Mini App.
225
- * `src/config.js` - Configuration for the Telegram bot.
226
- * `src/telegram.js` - Telegram client implementation.
222
+ - `main.js` - Core AIRouter library implementing the unified interface and fallback logic
223
+ - `provider.js` - Configuration for supported AI providers
224
+ - `openai-compatible-server/index.js` - OpenAI-compatible API server
225
+ - `tests/` - Comprehensive tests for the library, server, and tools
226
+ - `bruno/` - Bruno API collection for testing endpoints
227
+ - `vercel-project/` - Ready-to-deploy Vercel setup for the Telegram bot
228
+ - `api/index.js` - Telegram webhook handler
229
+ - `api/search.js` - Search proxy endpoint
230
+ - `public/` - Mini App frontend (HTML, CSS, JS)
231
+ - `src/config.js` - Bot configuration
232
+ - `src/telegram.js` - Telegram API integration
227
233
 
228
234
  ## ๐Ÿ“„ License
229
235