Credits Consumption
Overview
The Credits Consumption system tracks and manages real-time usage of MLC (Meclabs Credits) across all AI models, providers, and platform features. This system ensures transparent billing, enables usage optimization, and supports multiple consumption patterns from individual users to enterprise deployments with thousands of Customer Kits.
Consumption Model
MLC Unit Economics
The platform operates on a unified credit system where consumption is measured in MLC units:
- Base Unit: 1 MLC = $0.01 raw compute cost
- Billing Rate: $0.0135 per MLC (35% markup over base)
- Tracking Granularity: Per token, per message, per session
- Attribution Levels: Organization → Team → User → Widget → Session
Consumption Sources
Credits are consumed across multiple platform touchpoints:
- Agent Interactions: Expert consultations, App executions, Library queries
- Builder Tools: Headline generation, SuperFunnel creation, Agent Builder
- Workflow Orchestration: Multi-agent workflows, automated sequences
- API Calls: Direct model access, webhook processing, integrations
- Background Processing: Document indexing, RAG updates, scheduled tasks
Real-Time Tracking
Event Architecture
The platform uses OpenMeter for high-throughput event tracking:
interface ConsumptionEvent {
timestamp: Date;
eventType: "ai_tokens" | "feature_usage" | "background_task";
provider: "openai" | "anthropic" | "google" | "vertex";
model: string;
organizationId: string;
teamId?: string;
userId: string;
widgetId?: string;
sessionId: string;
inputTokens: number;
outputTokens: number;
mlcConsumed: number;
metadata?: {
expertId?: string;
appId?: string;
libraryId?: string;
workflowId?: string;
source: "ads" | "console" | "api" | "workflow";
};
}Streaming Consumption
For real-time AI responses, consumption tracks incrementally:
- Initial Request: Pre-flight token estimation
- Streaming Response: Progressive token counting
- Completion: Final reconciliation and billing
- Error Handling: Partial consumption on failures
Provider-Specific Rates
Model Consumption Matrix
| Provider | Model | Input (per 1M) | Output (per 1M) | MLC per 1M | Customer Cost |
|---|---|---|---|---|---|
| Gemini 1.5 Flash-Lite | $0.15 | $0.60 | 38 | $0.51 | |
| OpenAI | GPT-4o mini | $0.15 | $0.60 | 75 | $1.01 |
| OpenAI | GPT-4o | $2.50 | $10.00 | 1,250 | $16.88 |
| Anthropic | Claude 3.5 Sonnet | $3.00 | $15.00 | 1,800 | $24.30 |
| Anthropic | Claude 3 Opus | $15.00 | $75.00 | 9,000 | $121.50 |
Multimodal Consumption
Additional charges apply for non-text inputs:
- Images: Base rate + size multiplier (0.5x-2x based on resolution)
- Audio: Per-minute pricing converted to MLC equivalent
- Video: Per-second analysis at premium rates
- Documents: OCR processing + text extraction costs
Consumption Patterns
Organization-Level Consumption
Organizations consume credits from their pooled allocation:
interface OrgConsumption {
pooledCredits: number; // From subscription tier
topUpCredits: number; // Additional purchases
consumptionRate: number; // MLC per day average
projectedRunway: number; // Days until depletion
peakHours: number[]; // High-usage periods
primaryModels: string[]; // Most-used AI models
}Customer Kit Consumption
Each Customer Kit tracks isolated usage:
interface KitConsumption {
kitId: string;
monthlyAllocation: 1000; // Fixed MLC per kit
currentUsage: number; // This billing period
averageDaily: number; // Rolling 30-day average
lastActive: Date; // Most recent usage
topFeatures: string[]; // Primary consumption drivers
}Team-Level Budgets
Scale tier organizations can implement consumption controls:
interface TeamBudget {
teamId: string;
monthlyLimit?: number; // Optional cap
currentUsage: number; // Period-to-date
memberCount: number; // Active users
perUserAverage: number; // Usage distribution
alertThreshold: number; // Notification trigger
}Usage Attribution
Hierarchical Tracking
Consumption attributes through multiple dimensions:
- Organization: Aggregate platform usage
- Team: Department or project allocation
- User: Individual member consumption
- Widget: Per-deployment tracking
- Session: Conversation-level detail
- Message: Atomic interaction unit
Widget Analytics
ADS deployments provide detailed consumption insights:
interface WidgetAnalytics {
widgetId: string;
dailyUsers: number;
sessionsPerUser: number;
mlcPerSession: number;
conversionRate: number; // Sessions → outcomes
peakUsageHours: number[]; // Optimization opportunities
modelDistribution: {
// AI model usage
[model: string]: number; // Percentage of requests
};
}Overage Management
Automatic Overage Handling
When pooled credits exhaust, the system seamlessly continues:
- Detection: Real-time balance monitoring
- Continuation: Uninterrupted service delivery
- Billing: Automatic charge at $0.0135/MLC
- Notification: Admin alerts at thresholds
- Reconciliation: Monthly invoice with overage detail
Overage Prevention
Organizations can implement safeguards:
- Hard Limits: Stop consumption at threshold
- Soft Limits: Warnings without interruption
- Model Downgrades: Switch to efficient models
- Rate Limiting: Throttle high-volume users
- Queue Management: Defer non-critical tasks
Optimization Strategies
Model Selection Optimization
The platform automatically suggests efficient model usage:
interface ModelOptimization {
currentModel: string;
suggestedModel: string;
estimatedSavings: number; // MLC per month
qualityImpact: "none" | "minimal" | "moderate";
implementationEffort: "automatic" | "configuration" | "testing";
}Prompt Engineering
Reduce token consumption through optimization:
- System Prompt Compression: Minimize boilerplate
- Context Window Management: Efficient memory usage
- Response Length Control: Appropriate verbosity
- Caching Strategy: Reuse common responses
- Batch Processing: Combine related requests
Usage Patterns Analysis
The dashboard identifies optimization opportunities:
- Peak Hour Spreading: Distribute load for better rates
- Duplicate Detection: Cache repeated queries
- Model Rightsizing: Match complexity to task
- Bulk Operations: Batch similar requests
- Scheduled Tasks: Run during off-peak periods
Consumption Monitoring
Real-Time Dashboard
Organizations access live consumption data:
interface ConsumptionDashboard {
currentBalance: number; // Available MLC
burnRate: {
hourly: number;
daily: number;
weekly: number;
monthly: number;
};
topConsumers: Array<{
// Highest usage
userId: string;
mlcConsumed: number;
primaryUseCase: string;
}>;
modelBreakdown: Array<{
// Usage by AI model
model: string;
mlcConsumed: number;
requestCount: number;
}>;
projections: {
runwayDays: number; // Until credit depletion
monthEndEstimate: number; // Projected total
overageRisk: boolean; // Likelihood of overage
};
}Alert Thresholds
Configurable notifications for consumption milestones:
| Threshold | Trigger Condition | Notification Type | Recipients |
|---|---|---|---|
| 50% | Half of monthly allocation consumed | Admin | |
| 75% | Three-quarters consumed | Email + Dashboard | Admin + Team Leads |
| 90% | Approaching limit | Urgent Email | All stakeholders |
| 100% | Overage initiated | Real-time alert | Admin + Billing |
| Custom | User-defined threshold | Configurable | Specified users |
Historical Analytics
Consumption trends and patterns over time:
- Daily/Weekly/Monthly views: Usage evolution
- YoY Comparisons: Growth tracking
- Seasonal Patterns: Predictive planning
- Feature Adoption: New capability usage
- ROI Analysis: Consumption vs. revenue
Billing Integration
Stripe Automation
Consumption data flows directly to billing:
- Usage Events: Real-time ingestion to OpenMeter
- Aggregation: Hourly usage summaries
- Stripe Sync: Daily usage reporting
- Invoice Generation: Monthly consolidated billing
- Payment Processing: Automatic charge for overages
Invoice Details
Monthly statements include comprehensive usage data:
interface UsageInvoice {
period: { start: Date; end: Date };
subscription: {
tier: "Build" | "Sell" | "Scale";
includedCredits: number;
baseCost: number;
};
consumption: {
totalMLC: number;
includedMLC: number;
overageMLC: number;
overageCost: number; // At $0.0135/MLC
};
breakdown: {
byTeam: Array<{ name: string; mlc: number }>;
byModel: Array<{ model: string; mlc: number }>;
byFeature: Array<{ feature: string; mlc: number }>;
};
customerKits: {
active: number;
totalMLC: number;
averagePerKit: number;
};
}API Reference
Get Current Consumption
trpc.consumption.getCurrent({
organizationId: string,
timeRange?: "hour" | "day" | "week" | "month",
groupBy?: "team" | "user" | "model" | "widget"
})
// Response
{
totalConsumed: number,
periodStart: Date,
periodEnd: Date,
breakdown: Array<{
dimension: string,
mlcConsumed: number,
percentage: number
}>,
burnRate: number, // MLC per hour
projectedTotal: number // End of period estimate
}Set Consumption Limits
trpc.consumption.setLimits({
organizationId: string,
limits: {
monthly?: number, // Organization cap
team?: Record<string, number>, // Per-team limits
user?: Record<string, number>, // Per-user limits
hardStop: boolean // Interrupt service at limit
}
})
// Response
{
success: boolean,
activeLimits: object,
effectiveDate: Date
}Get Usage History
trpc.consumption.getHistory({
organizationId: string,
startDate: Date,
endDate: Date,
granularity: "hour" | "day" | "week" | "month",
});
// Response
Array<{
timestamp: Date;
mlcConsumed: number;
userCount: number;
sessionCount: number;
topModel: string;
}>;Cost Optimization Guide
For Administrators
- Set Team Budgets: Implement monthly limits per department
- Default Model Policy: Configure efficient models as defaults
- Usage Reviews: Weekly analysis of consumption patterns
- Training Programs: Educate users on efficient AI usage
- Automation Rules: Auto-switch models based on complexity
For Partners
- Customer Education: Train on credit-efficient practices
- Usage Monitoring: Proactive intervention for high consumers
- Bundle Optimization: Right-size Customer Kit allocations
- Value Demonstration: Show ROI through usage analytics
- Upgrade Guidance: Identify when customers need higher tiers
For End Users
- Model Selection: Use GPT-4o mini for standard tasks
- Prompt Efficiency: Be specific and concise
- Session Management: Close inactive conversations
- Batch Requests: Combine related queries
- Cache Utilization: Reuse previous responses when applicable
Performance Optimization
Caching Strategy
Reduce consumption through intelligent caching:
- Response Cache: Store common query results
- Embedding Cache: Reuse vector computations
- Session Context: Minimize repeated context
- Template Library: Pre-computed responses
- CDN Integration: Edge caching for static content
Rate Limiting
Protect against excessive consumption:
interface RateLimits {
messagesPerMinute: 10; // Per user
tokensPerHour: 50000; // Per organization
concurrentSessions: 100; // Platform-wide
burstAllowance: 1.5; // Temporary spike tolerance
}Compliance and Reporting
Audit Trail
All consumption events maintain compliance records:
- Timestamp: Precise usage timing
- User Attribution: Individual responsible
- Purpose Logging: Business justification
- Model Selection: AI provider and version
- Cost Allocation: Department/project charging
Export Capabilities
Organizations can export consumption data:
- CSV Reports: Detailed usage logs
- API Access: Programmatic data retrieval
- BI Integration: Connect to analytics platforms
- Accounting Sync: Direct ERP integration
- Compliance Packages: SOC2/GDPR formatted reports