Strait tracks cost usage reported by workers and enforces budget limits. When a run exceeds its budget, it pauses for approval or terminates automatically.
Granularity
Per-run and daily limits
Tracking
Real-time cost accumulation
Enforcement
Pause or terminate on breach
Reporting
Cost per run, job, and workflow
Models
Any model with token pricing
Alerts
Webhook on budget threshold
client.Runs.Create(ctx, strait.RunInput{
JobID: "ai-summarize",
Budget: &strait.Budget{
MaxCostPerRun: 1200, // $12.00 in cents
DailyLimit: 5000, // $50.00 in cents
OnExceed: strait.BudgetPause,
},
})
// Report usage from worker
sdk.ReportUsage(ctx, strait.Usage{
Tokens: 4200,
CostCents: 84,
Model: "gpt-4o",
})