agentlytics 0.1.5 → 0.1.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/server.js CHANGED
@@ -66,6 +66,7 @@ app.get('/api/chats', (req, res) => {
66
66
  encrypted: !!c.encrypted,
67
67
  bubbleCount: c.bubble_count,
68
68
  topModel: c.top_model || null,
69
+ cost: c.cost || 0,
69
70
  })),
70
71
  });
71
72
  } catch (err) {
@@ -159,6 +160,32 @@ app.get('/api/dashboard-stats', (req, res) => {
159
160
  }
160
161
  });
161
162
 
163
+ app.get('/api/cost-analytics', (req, res) => {
164
+ try {
165
+ const opts = {
166
+ editor: req.query.editor || null,
167
+ ...parseDateOpts(req.query),
168
+ };
169
+ res.json(cache.getCostAnalytics(opts));
170
+ } catch (err) {
171
+ res.status(500).json({ error: err.message });
172
+ }
173
+ });
174
+
175
+ app.get('/api/costs', (req, res) => {
176
+ try {
177
+ const opts = {
178
+ editor: req.query.editor || null,
179
+ folder: req.query.folder || null,
180
+ chatId: req.query.chatId || null,
181
+ ...parseDateOpts(req.query),
182
+ };
183
+ res.json(cache.getCostBreakdown(opts));
184
+ } catch (err) {
185
+ res.status(500).json({ error: err.message });
186
+ }
187
+ });
188
+
162
189
  app.get('/api/tool-calls', (req, res) => {
163
190
  try {
164
191
  const name = req.query.name;