Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/packages/core/src/billing/types.ts
overstepping7c445874bd3a
diff --git a/xspace-agent/packages/core/src/billing/types.ts b/xspace-agent/packages/core/src/billing/types.tsnew file mode 100644index 000000000..b01a6d918--- /dev/null+++ b/xspace-agent/packages/core/src/billing/types.ts@@ -0,0 +1,85 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§73]++// =============================================================================+// Billing Types — Usage Tracking, Quotas, and Metering+// =============================================================================++/** All billable metric types. */+export type UsageMetric =+ | 'session_minutes'+ | 'llm_input_tokens'+ | 'llm_output_tokens'+ | 'stt_minutes'+ | 'tts_characters'+ | 'api_calls'+ | 'storage_gb'+ | 'webhook_deliveries'++/** Result of a quota check. */+export interface QuotaResult {+ /** Whether the requested usage is allowed. */+ allowed: boolean+ /** Remaining quota for this metric in the current period. */+ remaining: number+ /** Total quota limit for this metric. */+ limit: number+ /** Amount already used in the current period. */+ used: number+ /** When the current billing period resets. */+ resetAt: Date+ /** If overage billing is enabled, the rate in cents per unit. */+ overageRate?: number+}++/** Summary of usage for a billing period. */+export interface UsageSummary {+ orgId: string+ period: string // YYYY-MM+ metrics: Record<UsageMetric, number>+ estimatedCostCents: number+ periodStart: Date+ periodEnd: Date+}++/** Breakdown of usage by agent and metric. */+export interface UsageBreakdown {+ agentId: string+ agentName?: string+ metrics: Partial<Record<UsageMetric, number>>+ costCents: number+}++/** Configuration for alert thresholds. */+export interface AlertThreshold {+ /** Percentage of quota used (0-100). */+ percent: number+ /** Notification channels to trigger. */+ channels: ('email' | 'in_app' | 'webhook')[]+}++/** Default alert thresholds. */+export const DEFAULT_ALERT_THRESHOLDS: AlertThreshold[] = [+ { percent: 50, channels: ['email'] },+ { percent: 75, channels: ['email', 'in_app'] },+ { percent: 90, channels: ['email', 'in_app', 'webhook'] },+ { percent: 100, channels: ['email', 'in_app', 'webhook'] },+]++/** Rate limit tiers by plan (requests per minute). */+export const RATE_LIMITS_BY_PLAN: Record<string, number> = {+ free: 10,+ developer: 100,+ pro: 500,+ business: 2000,+ enterprise: 10000,+}++/** Endpoint group rate limit percentages (of org total). */+export const ENDPOINT_GROUP_LIMITS: Record<string, number> = {+ agents: 0.5,+ conversations: 0.3,+ billing: 10, // flat 10 req/min for all plans+}++