Skip to content

Commit dc24b33

Browse files
committed
v8.10
1 parent 678bcc9 commit dc24b33

File tree

4 files changed

+164
-9
lines changed

4 files changed

+164
-9
lines changed

MyApp/_pages/ai-chat-analytics.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Admin UI Analytics for AI Chat
3+
---
4+
5+
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(new ChatFeature {
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:
38+
39+
```csharp
40+
services.AddSingleton<IChatStore, PostgresChatStore>();
41+
```
42+
43+
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+
![](/img/pages/ai-chat/admin-chat-costs.webp)
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+
![](/img/pages/ai-chat/admin-chat-tokens.webp)
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.
76+
77+
:::{.wideshot}
78+
![](/img/pages/ai-chat/admin-chat-activity.webp)
79+
:::
80+

MyApp/_pages/ai-chat-api.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,4 +477,75 @@ llms --serve 8000
477477
Incidentally as [llms.py UI](https://servicestack.net/posts/llms-py-ui) and AI Chat utilize the same UI you can
478478
use its **import/export** features to transfer your AI Chat History between them.
479479

480-
Checkout the [llms.py GitHub repo](https://github.com/ServiceStack/llms) for even more features.
480+
Checkout the [llms.py GitHub repo](https://github.com/ServiceStack/llms) for even more features.
481+
482+
## FREE Gemini, Minimax M2, GLM 4.6, Kimi K2 in AI Chat
483+
484+
To give AI Chat instant utility, we're making available a free `servicestack` OpenAI Chat provider that can be enabled with:
485+
486+
```csharp
487+
services.AddPlugin(new ChatFeature {
488+
EnableProviders = [
489+
"servicestack",
490+
// "groq",
491+
// "google_free",
492+
// "openrouter_free",
493+
// "ollama",
494+
// "google",
495+
// "anthropic",
496+
// "openai",
497+
// "grok",
498+
// "qwen",
499+
// "z.ai",
500+
// "mistral",
501+
// "openrouter",
502+
]
503+
});
504+
```
505+
506+
The `servicestack` provider is configured with a default `llms.json` which enables access to Gemini and the
507+
best value OSS models for FREE:
508+
509+
```json
510+
{
511+
"providers": {
512+
"servicestack": {
513+
"enabled": false,
514+
"type": "OpenAiProvider",
515+
"base_url": "http://okai.servicestack.com",
516+
"api_key": "$SERVICESTACK_LICENSE",
517+
"models": {
518+
"gemini-flash-latest": "gemini-flash-latest",
519+
"gemini-flash-lite-latest": "gemini-flash-lite-latest",
520+
"kimi-k2": "kimi-k2",
521+
"kimi-k2-thinking": "kimi-k2-thinking",
522+
"minimax-m2": "minimax-m2",
523+
"glm-4.6": "glm-4.6",
524+
"gpt-oss:20b": "gpt-oss:20b",
525+
"gpt-oss:120b": "gpt-oss:120b",
526+
"llama4:400b": "llama4:400b",
527+
"mistral-small3.2:24b": "mistral-small3.2:24b"
528+
}
529+
}
530+
}
531+
}
532+
```
533+
534+
The `servicestack` provider requires the `SERVICESTACK_LICENSE` Environment Variable, although any ServiceStack License Key can be used, including expired and Free ones.
535+
536+
:::{.not-prose}
537+
:::{.my-8 .max-w-3xl .mx-auto .rounded-lg .overflow-hidden .shadow .hover:shadow-xl}
538+
[![](/img/pages/ai-chat/llms-syntax.webp)](/ai-chat-ui)
539+
:::
540+
:::
541+
542+
### FREE for Personal Usage
543+
544+
To be able to maintain this as a free service we're limiting usage for development or personal assistance and research
545+
by limiting usage to **60 requests /hour** which should be more than enough for most personal usage and research whilst
546+
deterring usage in automated tools or usage in production.
547+
548+
:::tip info
549+
Rate limiting is implemented with a sliding [Token Bucket algorithm](https://en.wikipedia.org/wiki/Token_bucket)
550+
that replenishes 1 additional request every 60s
551+
:::

MyApp/_pages/releases/v8_10.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ We're introducing three production-ready React templates, each optimized for dif
9090

9191
## Comprehensive React Component Library
9292

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.
9494

9595
:::{.not-prose}
9696
:::{.my-8 .max-w-3xl .mx-auto .rounded-lg .overflow-hidden .shadow .hover:shadow-xl}
@@ -111,7 +111,7 @@ ServiceStack's first-class React support positions your applications at the fore
111111
## TypeScript Data Models
112112

113113
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.
115115

116116
With just a TypeScript Definition:
117117

@@ -125,11 +125,11 @@ npx okai Bookings.d.ts
125125

126126
This is enough to generate a complete CRUD UI to manage Bookings
127127
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/):
129129

130130
:::{.not-prose}
131131
:::{.my-8 .max-w-3xl .mx-auto .rounded-lg .overflow-hidden .shadow .hover:shadow-xl}
132-
[![](/img/pages/react/bookings-locode.webp)](https://docs.servicestack.net/locode/)
132+
[![](/img/pages/react/bookings-locode.webp)](/locode/)
133133
:::
134134
:::
135135

@@ -313,7 +313,7 @@ Beyond llms.py's core features, ServiceStack's AI Chat adds integrated authentic
313313

314314
## AI Chat Admin Analytics
315315

316-
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.
317317

318318
:::sh
319319
x mix chat
@@ -339,7 +339,7 @@ request and response flowing through AI Chat's UI, external OpenAI endpoints and
339339
ServiceStack provides two storage implementations to suit different deployment scenarios:
340340

341341
`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):
343343

344344
```csharp
345345
services.AddSingleton<IChatStore,DbChatStore>();
@@ -461,11 +461,11 @@ The lightweight implementation adds minimal footprint to your application while
461461

462462
The `servicestack` provider requires the `SERVICESTACK_LICENSE` Environment Variable, although any ServiceStack License Key can be used, including expired and Free ones.
463463

464-
Learn more about [AI Chat's UI](https://docs.servicestack.net/ai-chat-ui):
464+
Learn more about [AI Chat's UI](/ai-chat-ui):
465465

466466
:::{.not-prose}
467467
:::{.my-8 .max-w-3xl .mx-auto .rounded-lg .overflow-hidden .shadow .hover:shadow-xl}
468-
[![](/img/pages/ai-chat/llms-syntax.webp)](https://docs.servicestack.net/ai-chat-ui)
468+
[![](/img/pages/ai-chat/llms-syntax.webp)](/ai-chat-ui)
469469
:::
470470
:::
471471

MyApp/_pages/sidebar.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,10 @@
191191
"text": "AI Chat - ChatGPT-like UI",
192192
"link": "/ai-chat-ui"
193193
},
194+
{
195+
"text": "AI Chat - Admin UI Analytics",
196+
"link": "/ai-chat-analytics"
197+
},
194198
{
195199
"text": "Custom API Explorer UI",
196200
"link": "/ai-chat-custom-explorer-ui"

0 commit comments

Comments
 (0)