mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-12 15:26:55 +08:00
feat: add channel dimension to GA4 AI usage tracking
Distinguish claw402, blockrun, and native direct API calls in telemetry.
This commit is contained in:
@@ -44,13 +44,26 @@ var (
|
||||
|
||||
// TokenUsage represents token usage from AI API response
|
||||
type TokenUsage struct {
|
||||
Provider string
|
||||
Provider string // payment channel: "claw402", "blockrun-base", "blockrun-sol", or native provider name
|
||||
Model string
|
||||
PromptTokens int
|
||||
CompletionTokens int
|
||||
TotalTokens int
|
||||
}
|
||||
|
||||
// Channel returns the payment channel category for telemetry.
|
||||
// Returns "claw402", "blockrun", or "native" based on the provider.
|
||||
func (u TokenUsage) Channel() string {
|
||||
switch u.Provider {
|
||||
case ProviderClaw402:
|
||||
return "claw402"
|
||||
case ProviderBlockRunBase, ProviderBlockRunSol:
|
||||
return "blockrun"
|
||||
default:
|
||||
return "native"
|
||||
}
|
||||
}
|
||||
|
||||
// Client AI API configuration
|
||||
type Client struct {
|
||||
Provider string
|
||||
|
||||
Reference in New Issue
Block a user