@agentlify/mcp-server 2.0.0

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.
@@ -0,0 +1,242 @@
1
+ # Agentlify 5-Minute Quickstart
2
+
3
+ Get started with intelligent AI routing in under 5 minutes.
4
+
5
+ ---
6
+
7
+ ## What You'll Do
8
+
9
+ 1. Create account & router (2 min)
10
+ 2. Update your code (1 min)
11
+ 3. Make your first request (1 min)
12
+ 4. View cost savings (1 min)
13
+
14
+ **Total: 5 minutes to 40-60% cost savings!**
15
+
16
+ ---
17
+
18
+ ## Step 1: Create Account & Router (2 min)
19
+
20
+ ### 1.1 Sign Up
21
+
22
+ Visit [agentlify.app](https://agentlify.app) and create your free account.
23
+
24
+ ### 1.2 Create Your First Router
25
+
26
+ Click "Create Router" and choose your optimization priority:
27
+
28
+ - **Cost-Optimized** 💰 - Minimize costs (recommended for most)
29
+ - **Quality-Optimized** 🎯 - Best performance
30
+ - **Speed-Optimized** ⚡ - Lowest latency
31
+
32
+ Router is created instantly with access to 100+ models.
33
+
34
+ ### 1.3 Get Credentials
35
+
36
+ 1. **API Key**: Go to Settings → API Keys → Generate (starts with `mp_`)
37
+ 2. **Router ID**: Copy from your router's page
38
+
39
+ ---
40
+
41
+ ## Step 2: Update Your Code (1 min)
42
+
43
+ ### Python
44
+
45
+ ```python
46
+ from openai import OpenAI # Keep using OpenAI SDK!
47
+
48
+ # Just change these two lines:
49
+ client = OpenAI(
50
+ api_key="mp_your_api_key",
51
+ base_url="https://agentlify.co/api/router/your_router_id"
52
+ )
53
+
54
+ # Everything else works the same!
55
+ response = client.chat.completions.create(
56
+ messages=[{"role": "user", "content": "Hello!"}]
57
+ )
58
+
59
+ print(response.choices[0].message.content)
60
+ ```
61
+
62
+ ### JavaScript/TypeScript
63
+
64
+ ```javascript
65
+ const { OpenAI } = require('openai'); // Keep using OpenAI SDK!
66
+
67
+ // Just change these two lines:
68
+ const client = new OpenAI({
69
+ apiKey: 'mp_your_api_key',
70
+ baseURL: 'https://agentlify.co/api/router/your_router_id',
71
+ });
72
+
73
+ // Everything else works the same!
74
+ const response = await client.chat.completions.create({
75
+ messages: [{ role: 'user', content: 'Hello!' }],
76
+ });
77
+
78
+ console.log(response.choices[0].message.content);
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Step 3: Make Your First Request (1 min)
84
+
85
+ Run your code! Agentlify will:
86
+
87
+ 1. ✅ Automatically select the best model
88
+ 2. ✅ Route your request intelligently
89
+ 3. ✅ Return the response
90
+ 4. ✅ Track costs and performance
91
+
92
+ ### Example Response:
93
+
94
+ ```javascript
95
+ {
96
+ choices: [{
97
+ message: { content: "Hello! How can I help you today?" }
98
+ }],
99
+ _meta: {
100
+ cost: 0.0008, // Actual cost in USD
101
+ modelUsed: "gpt-4o-mini", // Which model was selected
102
+ latency: 450, // Response time in ms
103
+ requestId: "req_abc123"
104
+ }
105
+ }
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Step 4: View Cost Savings (1 min)
111
+
112
+ ### Dashboard Analytics
113
+
114
+ Go to your router's dashboard to see:
115
+
116
+ - 💰 **Total cost** vs. OpenAI-only cost
117
+ - 📊 **Savings percentage** (typically 40-60%)
118
+ - 📈 **Request volume** over time
119
+ - 🤖 **Model distribution** (which models are being used)
120
+
121
+ ### Use MCP Tools (Optional)
122
+
123
+ If you're using an AI assistant with MCP:
124
+
125
+ ```
126
+ User: "Show my usage for the last 7 days"
127
+
128
+ AI Assistant:
129
+ Total cost: $12.45
130
+ Requests: 1,234
131
+ Average cost per request: $0.0101
132
+ Top model: gpt-4o-mini (65%)
133
+ Savings vs OpenAI: 52% ($13.58 saved)
134
+ ```
135
+
136
+ ---
137
+
138
+ ## What's Next?
139
+
140
+ You're all set! Here's what you can explore:
141
+
142
+ ### 📚 Learn More
143
+
144
+ - [OpenAI Migration Guide](./migration-openai.md) - Detailed migration
145
+ - [Router Configuration](./router-configuration.md) - Advanced settings
146
+ - [Cost Optimization](./cost-optimization.md) - Save even more
147
+
148
+ ### 🛠️ Optimize Further
149
+
150
+ Use MCP tools in your AI assistant:
151
+
152
+ ```
153
+ "Optimize my router for cost savings"
154
+ "Compare GPT-4 vs Claude 3.5 Sonnet"
155
+ "Generate production code for my router"
156
+ ```
157
+
158
+ ### 🎯 Common Use Cases
159
+
160
+ **Chatbot:**
161
+
162
+ ```javascript
163
+ const response = await client.chat.completions.create({
164
+ messages: conversationHistory,
165
+ stream: true, // Streaming works!
166
+ });
167
+ ```
168
+
169
+ **Function Calling:**
170
+
171
+ ```javascript
172
+ const response = await client.chat.completions.create({
173
+ messages: [{ role: 'user', content: 'Get weather in NYC' }],
174
+ tools: [{ type: 'function', function: weatherTool }],
175
+ });
176
+ ```
177
+
178
+ **JSON Mode:**
179
+
180
+ ```javascript
181
+ const response = await client.chat.completions.create({
182
+ messages: [{ role: 'user', content: 'Generate JSON data' }],
183
+ response_format: { type: 'json_object' },
184
+ });
185
+ ```
186
+
187
+ ---
188
+
189
+ ## Key Features
190
+
191
+ ✅ **Zero code changes** - Use existing OpenAI SDK
192
+ ✅ **Automatic optimization** - Router selects best model
193
+ ✅ **40-60% cost savings** - Intelligent routing
194
+ ✅ **100+ models** - OpenAI, Anthropic, Google, more
195
+ ✅ **Real-time analytics** - Track every request
196
+ ✅ **Automatic fallbacks** - Improved reliability
197
+
198
+ ---
199
+
200
+ ## Environment Variables (Best Practice)
201
+
202
+ Create `.env` file:
203
+
204
+ ```bash
205
+ AGENTLIFY_API_KEY=mp_your_api_key_here
206
+ AGENTLIFY_ROUTER_ID=your_router_id_here
207
+ ```
208
+
209
+ Update your code:
210
+
211
+ ```javascript
212
+ const client = new OpenAI({
213
+ apiKey: process.env.AGENTLIFY_API_KEY,
214
+ baseURL: `https://agentlify.co/api/router/${process.env.AGENTLIFY_ROUTER_ID}`,
215
+ });
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Troubleshooting
221
+
222
+ ### "Invalid API Key"
223
+
224
+ - Make sure you're using your Agentlify key (`mp_xxx`), not OpenAI key
225
+ - Check Settings → API Keys in dashboard
226
+
227
+ ### "Router not found"
228
+
229
+ - Verify Router ID in baseURL matches your router
230
+ - Check router is active in dashboard
231
+
232
+ ### Need Help?
233
+
234
+ - **Docs**: [agentlify.app/docs](https://agentlify.app/docs)
235
+ - **Support**: support@agentlify.app
236
+ - **AI Assistant**: Use MCP tools for instant help
237
+
238
+ ---
239
+
240
+ **That's it!** You're now using Agentlify for intelligent AI routing. 🎉
241
+
242
+ **Next recommended reading:** [OpenAI Migration Guide](./migration-openai.md)