You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ServiceStack's [AI Chat](/ai-chat-api) feature provides a unified API for integrating multiple AI providers into your applications. To gain visibility into usage patterns, costs, and performance across your AI infrastructure, the platform includes comprehensive chat history persistence and analytics capabilities.
6
+
7
+
:::sh
8
+
x mix chat
9
+
:::
10
+
11
+
Or by referencing the **ServiceStack.AI.Chat** NuGet package and adding the `ChatFeature` plugin:
12
+
13
+
```csharp
14
+
services.AddPlugin(newChatFeature {
15
+
EnableProviders= [
16
+
"servicestack",
17
+
]
18
+
});
19
+
```
20
+
21
+
## AI Chat History Persistence
22
+
23
+
Enabling chat history persistence allows you to maintain a complete audit trail of all AI interactions, track token consumption, monitor costs across providers and models, and analyze usage patterns over time that captures every
24
+
request and response flowing through AI Chat's UI, external OpenAI endpoints and internal `IChatStore` requests.
25
+
26
+
### Database Storage Options
27
+
28
+
ServiceStack provides two storage implementations to suit different deployment scenarios:
29
+
30
+
`DbChatStore` - A universal solution that stores chat history in a single table compatible with any RDBMS
31
+
[supported by OrmLite](/ormlite/getting-started):
32
+
33
+
```csharp
34
+
services.AddSingleton<IChatStore,DbChatStore>();
35
+
```
36
+
37
+
`PostgresChatStore` - An optimized implementation for PostgreSQL that leverages monthly table partitioning for improved query performance and data management:
Both implementations utilize indexed queries with result limits to ensure consistent performance even as your chat history grows. The partitioned approach in PostgreSQL offers additional benefits for long-term data retention and archival strategies.
44
+
45
+
## Admin UI Analytics
46
+
47
+
Once chat history persistence is enabled, the Admin UI provides comprehensive analytics dashboards that deliver actionable insights into your AI infrastructure. The analytics interface offers multiple views to help you understand costs, optimize token usage, and monitor activity patterns across all configured AI providers and models.
48
+
49
+
The analytics dashboard includes three primary tabs:
50
+
51
+
-**Cost Analysis** - Track spending across providers and models with daily and monthly breakdowns
52
+
-**Token Usage** - Monitor input and output token consumption to identify optimization opportunities
53
+
-**Activity** - Review detailed request logs with full conversation history and metadata
54
+
55
+
These visualizations enable data-driven decisions about provider selection, model usage, and cost optimization strategies.
56
+
57
+
### Cost Analysis
58
+
59
+
The Cost Analysis tab provides financial visibility into your AI operations with interactive visualizations showing spending distribution across providers and models. Daily cost trends help identify usage spikes, while monthly aggregations reveal long-term patterns. Pie charts break down costs by individual models and providers, making it easy to identify your most expensive AI resources and opportunities for cost optimization.
60
+
61
+
:::{.wideshot}
62
+

63
+
:::
64
+
65
+
### Token Usage
66
+
67
+
The Token Usage tab tracks both input (prompt) and output (completion) tokens across all requests. Daily usage charts display token consumption trends over time, while model and provider breakdowns show which AI resources consume the most tokens. This granular visibility helps optimize prompt engineering, identify inefficient usage patterns, and forecast capacity requirements.
68
+
69
+
:::{.wideshot}
70
+

71
+
:::
72
+
73
+
### Activity Log
74
+
75
+
The Activity tab maintains a searchable log of all AI chat requests, displaying timestamps, models, providers, and associated costs. Clicking any request opens a detailed view showing the complete conversation including user prompts, AI responses, token counts, duration, and the full request payload. This audit trail is invaluable for debugging, quality assurance, and understanding how your AI features are being used in production.
The `servicestack` provider requires the `SERVICESTACK_LICENSE` Environment Variable, although any ServiceStack License Key can be used, including expired and Free ones.
Copy file name to clipboardExpand all lines: MyApp/_pages/releases/v8_10.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,7 +90,7 @@ We're introducing three production-ready React templates, each optimized for dif
90
90
91
91
## Comprehensive React Component Library
92
92
93
-
All three templates leverage our new [React Component Gallery](https://react.servicestack.net)—a high-fidelity port of our proven [Vue Component Library](https://docs.servicestack.net/vue/) and [Blazor Component Library](https://blazor.servicestack.net). This comprehensive collection provides everything needed to build highly productive, modern and responsive web applications.
93
+
All three templates leverage our new [React Component Gallery](https://react.servicestack.net)—a high-fidelity port of our proven [Vue Component Library](/vue/) and [Blazor Component Library](https://blazor.servicestack.net). This comprehensive collection provides everything needed to build highly productive, modern and responsive web applications.
@@ -111,7 +111,7 @@ ServiceStack's first-class React support positions your applications at the fore
111
111
## TypeScript Data Models
112
112
113
113
As AI Models are not as adept at generating C# APIs or Migrations yet, they excel at generating TypeScript code, which our
114
-
[TypeScript Data Models](https://docs.servicestack.net/autoquery/okai-models) feature can take advantage of by generating all the C# AutoQuery CRUD APIs and DB Migrations needing to support it.
114
+
[TypeScript Data Models](/autoquery/okai-models) feature can take advantage of by generating all the C# AutoQuery CRUD APIs and DB Migrations needing to support it.
115
115
116
116
With just a TypeScript Definition:
117
117
@@ -125,11 +125,11 @@ npx okai Bookings.d.ts
125
125
126
126
This is enough to generate a complete CRUD UI to manage Bookings
127
127
in your React App with the [React AutoQueryGrid Component](https://react.servicestack.net/gallery/autoquerygrid).
128
-
or with ServiceStack's built-in [Locode UI](https://docs.servicestack.net/locode/):
128
+
or with ServiceStack's built-in [Locode UI](/locode/):
ServiceStack's [AI Chat](https://docs.servicestack.net/ai-chat-api) feature provides a unified API for integrating multiple AI providers into your applications. To gain visibility into usage patterns, costs, and performance across your AI infrastructure, the platform includes comprehensive chat history persistence and analytics capabilities.
316
+
ServiceStack's [AI Chat](/ai-chat-api) feature provides a unified API for integrating multiple AI providers into your applications. To gain visibility into usage patterns, costs, and performance across your AI infrastructure, the platform includes comprehensive chat history persistence and analytics capabilities.
317
317
318
318
:::sh
319
319
x mix chat
@@ -339,7 +339,7 @@ request and response flowing through AI Chat's UI, external OpenAI endpoints and
339
339
ServiceStack provides two storage implementations to suit different deployment scenarios:
340
340
341
341
`DbChatStore` - A universal solution that stores chat history in a single table compatible with any RDBMS
342
-
[supported by OrmLite](https://docs.servicestack.net/ormlite/getting-started):
342
+
[supported by OrmLite](/ormlite/getting-started):
343
343
344
344
```csharp
345
345
services.AddSingleton<IChatStore,DbChatStore>();
@@ -461,11 +461,11 @@ The lightweight implementation adds minimal footprint to your application while
461
461
462
462
The `servicestack` provider requires the `SERVICESTACK_LICENSE` Environment Variable, although any ServiceStack License Key can be used, including expired and Free ones.
463
463
464
-
Learn more about [AI Chat's UI](https://docs.servicestack.net/ai-chat-ui):
0 commit comments