overai 1.4.19 → 1.4.20
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 +253 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,259 @@ npm install overai
|
|
|
48
48
|
|
|
49
49
|
## ✨ Auto-Coder CLI (Magic Project Generator)
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Want to build a project instantly? OverAI includes a powerful CLI that can scaffold entire projects (React, Node, Python, etc.) from a single prompt.
|
|
52
|
+
|
|
53
|
+
**Usage:**
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 1. Set your API Key (OpenAI, Gemini, or Anthropic)
|
|
57
|
+
export OPENAI_API_KEY=sk-...
|
|
58
|
+
# OR
|
|
59
|
+
export GOOGLE_API_KEY=AIza...
|
|
60
|
+
|
|
61
|
+
# 2. Run the magic command
|
|
62
|
+
npx overai-create "A personal portfolio website with HTML/CSS"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
|
|
67
|
+
* **Auto-Detection**: The CLI automatically picks the best model based on your environment variables.
|
|
68
|
+
* **Force Model**: You can specify a model manually:
|
|
69
|
+
```bash
|
|
70
|
+
npx overai-create "A snake game in Python" --model google/gemini-2.0-flash-exp
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## ⚡ Quick Start: Gemini Example
|
|
76
|
+
|
|
77
|
+
1. **Create `tsconfig.json`**:
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"compilerOptions": {
|
|
81
|
+
"module": "ESNext",
|
|
82
|
+
"moduleResolution": "node",
|
|
83
|
+
"target": "ES2020",
|
|
84
|
+
"esModuleInterop": true,
|
|
85
|
+
"skipLibCheck": true,
|
|
86
|
+
"strict": true,
|
|
87
|
+
"resolveJsonModule": true,
|
|
88
|
+
"allowSyntheticDefaultImports": true
|
|
89
|
+
},
|
|
90
|
+
"ts-node": {
|
|
91
|
+
"esm": true,
|
|
92
|
+
"experimentalSpecifierResolution": "node"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
2. **Create `main.ts`**:
|
|
98
|
+
```typescript
|
|
99
|
+
import { Agent, OverAI } from 'overai';
|
|
100
|
+
|
|
101
|
+
async function main() {
|
|
102
|
+
// 1. Créer un agent
|
|
103
|
+
const agent = new Agent({
|
|
104
|
+
name: "GeminiAgent",
|
|
105
|
+
instructions: "Tu es Gemini, un modèle de Google. Réponds en français.",
|
|
106
|
+
llm: "google/gemini-2.0-flash",
|
|
107
|
+
verbose: true
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// 2. Configurer OverAI avec l'agent et une tâche
|
|
111
|
+
const overAI = new OverAI({
|
|
112
|
+
agents: [agent],
|
|
113
|
+
tasks: ["Explique-moi ce qu'est un Agent IA en une phrase simple."],
|
|
114
|
+
verbose: true
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
// 3. Lancer l'exécution
|
|
118
|
+
console.log("🚀 Démarrage de OverAI...");
|
|
119
|
+
try {
|
|
120
|
+
const result = await overAI.start();
|
|
121
|
+
console.log("\n✅ Résultat :");
|
|
122
|
+
console.log(result);
|
|
123
|
+
} catch (error) {
|
|
124
|
+
console.error("❌ Erreur :", error);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
main();
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
3. **Run the agent**:
|
|
132
|
+
```bash
|
|
133
|
+
export GOOGLE_API_KEY="your-gemini-key"
|
|
134
|
+
npx tsx main.ts
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## 🤝 Multi-Agent Collaboration
|
|
140
|
+
|
|
141
|
+
Create a team of agents that work together.
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
import { Agent, OverAI } from 'overai';
|
|
145
|
+
|
|
146
|
+
async function main() {
|
|
147
|
+
const researcher = new Agent({
|
|
148
|
+
name: "Researcher",
|
|
149
|
+
instructions: "Research the latest trends in AI.",
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
const writer = new Agent({
|
|
153
|
+
name: "Writer",
|
|
154
|
+
instructions: "Write a blog post based on the research provided.",
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const overAI = new OverAI({
|
|
158
|
+
agents: [researcher, writer],
|
|
159
|
+
tasks: [
|
|
160
|
+
"Research 3 top AI trends for 2025.",
|
|
161
|
+
"Write a short blog post summarizing these trends."
|
|
162
|
+
],
|
|
163
|
+
verbose: true
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
await overAI.start();
|
|
167
|
+
}
|
|
168
|
+
main();
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 💸 SaaS & Monetization Starter Kit
|
|
174
|
+
|
|
175
|
+
OverAI comes with a **complete SaaS API Server example**. Use this to launch your own AI business.
|
|
176
|
+
|
|
177
|
+
### Features Included:
|
|
178
|
+
- **Authentication**: Secure API Key middleware (`x-api-key`).
|
|
179
|
+
- **Billing System**: Credit deduction per request (1 credit = 1 request).
|
|
180
|
+
- **Payment Gateway**: Mock Stripe integration to simulate top-ups.
|
|
181
|
+
- **Webhooks**: N8N compatible endpoints.
|
|
182
|
+
|
|
183
|
+
### How to Run Your SaaS Backend:
|
|
184
|
+
|
|
185
|
+
1. **Set your OpenAI Key**:
|
|
186
|
+
```bash
|
|
187
|
+
export OPENAI_API_KEY="sk-..."
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
2. **Start the Server**:
|
|
191
|
+
```bash
|
|
192
|
+
npx ts-node examples/saas-server.ts
|
|
193
|
+
```
|
|
194
|
+
*Server starts at `http://localhost:3001`*
|
|
195
|
+
|
|
196
|
+
3. **Test Monetization**:
|
|
197
|
+
* **Top-up Credits** (Simulate Stripe):
|
|
198
|
+
```bash
|
|
199
|
+
curl -X POST http://localhost:3001/api/billing/topup \
|
|
200
|
+
-H "Content-Type: application/json" \
|
|
201
|
+
-H "x-api-key: sk_demo_12345" \
|
|
202
|
+
-d '{"amount": 10.00}'
|
|
203
|
+
```
|
|
204
|
+
* **Paid Chat Request**:
|
|
205
|
+
```bash
|
|
206
|
+
curl -X POST http://localhost:3001/api/v1/agent/chat \
|
|
207
|
+
-H "Content-Type: application/json" \
|
|
208
|
+
-H "x-api-key: sk_demo_12345" \
|
|
209
|
+
-d '{"message": "Hello, I paid for this!"}'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## 🔌 Integrations & Workflows
|
|
215
|
+
|
|
216
|
+
### N8N Integration
|
|
217
|
+
OverAI agents can be triggered via webhooks, making them perfect for N8N workflows.
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
// Example N8N Webhook Endpoint (included in saas-server.ts)
|
|
221
|
+
app.post('/api/webhook/n8n', async (req, res) => {
|
|
222
|
+
const { workflow_data } = req.body;
|
|
223
|
+
// Process N8N data with agents...
|
|
224
|
+
res.json({ status: "success", result: agentResponse });
|
|
225
|
+
});
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Model Context Protocol (MCP)
|
|
229
|
+
Support for the MCP standard allows your agents to safely access local files, databases, and external tools without custom glue code.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## 🛠️ Development
|
|
234
|
+
|
|
235
|
+
To contribute or modify the framework:
|
|
236
|
+
|
|
237
|
+
1. **Clone your fork**:
|
|
238
|
+
```bash
|
|
239
|
+
git clone https://github.com/your-username/overai.git
|
|
240
|
+
cd overai
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
2. **Install & Build**:
|
|
244
|
+
```bash
|
|
245
|
+
npm install
|
|
246
|
+
npm run build
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 💰 Business-in-a-Box (SaaS Starter Kit)
|
|
250
|
+
|
|
251
|
+
Launch your own AI API business in minutes. We provide a complete **SaaS Server Example** including:
|
|
252
|
+
* **Stripe Integration** (Mock): Simulate payments and top-ups.
|
|
253
|
+
* **Credit System**: Deduct credits per request (1 credit = 1 request).
|
|
254
|
+
* **API Authentication**: Secure endpoints with API Keys.
|
|
255
|
+
* **Rate Limiting**: Prevent abuse from free users.
|
|
256
|
+
|
|
257
|
+
**Run the SaaS Server:**
|
|
258
|
+
```bash
|
|
259
|
+
# Install dependencies
|
|
260
|
+
npm install express @types/express
|
|
261
|
+
|
|
262
|
+
# Run the server
|
|
263
|
+
npx ts-node examples/saas-server.ts
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
**Test your API:**
|
|
267
|
+
```bash
|
|
268
|
+
curl -X POST http://localhost:3001/api/v1/agent/chat \
|
|
269
|
+
-H "Content-Type: application/json" \
|
|
270
|
+
-H "x-api-key: sk_demo_12345" \
|
|
271
|
+
-d '{"message": "Hello, explain how you work in 1 sentence."}'
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## 🏢 Enterprise & Licensing (Open Core)
|
|
275
|
+
|
|
276
|
+
OverAI follows an **Open Core** model. The core framework is MIT-licensed and free forever.
|
|
277
|
+
For enterprises requiring advanced features, we provide a commercial license that unlocks:
|
|
278
|
+
|
|
279
|
+
* **SSO & Identity**: Integrate with Okta, Active Directory, and Google Workspace.
|
|
280
|
+
* **Audit Logs**: Comprehensive tracking of every agent action for compliance.
|
|
281
|
+
* **Role-Based Access Control (RBAC)**: Fine-grained permissions for teams.
|
|
282
|
+
* **Priority Support**: SLA-backed support with < 4h response time.
|
|
283
|
+
|
|
284
|
+
To enable enterprise features:
|
|
285
|
+
|
|
286
|
+
```typescript
|
|
287
|
+
import { license } from 'overai';
|
|
288
|
+
|
|
289
|
+
// Verify your license key
|
|
290
|
+
await license.setLicenseKey(process.env.OVERAI_LICENSE_KEY);
|
|
291
|
+
|
|
292
|
+
if (license.hasFeature('audit_logs')) {
|
|
293
|
+
console.log("✅ Enterprise Audit Logs Enabled");
|
|
294
|
+
}
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Contact **sales@overai.com** for pricing and details.
|
|
298
|
+
|
|
299
|
+
## License
|
|
300
|
+
|
|
301
|
+
MIT
|
|
302
|
+
|
|
303
|
+
## Author
|
|
52
304
|
|
|
53
305
|
**JMK**
|
|
54
306
|
* Email: anouslecode@gmail.com
|