Documentation
¶
Overview ¶
Package api provides cost intelligence API endpoints
Index ¶
- type AlertData
- type AlertsResponse
- type AnomaliesResponse
- type AnomalyData
- type BudgetStatusResponse
- type CostBreakdownResponse
- type CostForecastResponse
- type CostIntelligenceAPI
- type CostSummaryResponse
- type CostTrendPoint
- type CostTrendsResponse
- type DailyCostPoint
- type ExportResponse
- type ForecastPoint
- type ModelComparisonData
- type ModelComparisonResponse
- type TeamCostData
- type TeamCostsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlertData ¶
type AlertData struct {
ID string `json:"id"`
Type string `json:"type"`
Message string `json:"message"`
Severity string `json:"severity"`
CreatedAt time.Time `json:"created_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
Value float64 `json:"value"`
Threshold float64 `json:"threshold"`
}
AlertData represents alert data
type AlertsResponse ¶
type AlertsResponse struct {
Active []AlertData `json:"active"`
Resolved []AlertData `json:"resolved"`
Total int `json:"total"`
}
AlertsResponse represents alerts response
type AnomaliesResponse ¶
type AnomaliesResponse struct {
Anomalies []AnomalyData `json:"anomalies"`
Total int `json:"total"`
}
AnomaliesResponse represents anomalies response
type AnomalyData ¶
type AnomalyData struct {
Type string `json:"type"`
Description string `json:"description"`
Severity string `json:"severity"`
DetectedAt time.Time `json:"detected_at"`
Value float64 `json:"value"`
Expected float64 `json:"expected"`
Deviation float64 `json:"deviation"`
}
AnomalyData represents anomaly data
type BudgetStatusResponse ¶
type BudgetStatusResponse struct {
MonthlyBudget float64 `json:"monthly_budget"`
MonthlySpend float64 `json:"monthly_spend"`
UsagePercent float64 `json:"usage_percent"`
ProjectedSpend float64 `json:"projected_spend"`
DaysRemaining int `json:"days_remaining"`
IsAtRisk bool `json:"is_at_risk"`
BurnRate float64 `json:"burn_rate"`
AlertThreshold float64 `json:"alert_threshold"`
}
BudgetStatusResponse represents budget status response
type CostBreakdownResponse ¶
type CostBreakdownResponse struct {
InputCost float64 `json:"input_cost"`
OutputCost float64 `json:"output_cost"`
CacheCost float64 `json:"cache_cost"`
ByModel map[string]float64 `json:"by_model"`
ByTeam map[string]float64 `json:"by_team"`
ByDay []DailyCostPoint `json:"by_day"`
}
CostBreakdownResponse represents cost breakdown response
type CostForecastResponse ¶
type CostForecastResponse struct {
CurrentSpend float64 `json:"current_spend"`
ProjectedMonthly float64 `json:"projected_monthly"`
ProjectedYearly float64 `json:"projected_yearly"`
ConfidenceLow float64 `json:"confidence_low"`
ConfidenceHigh float64 `json:"confidence_high"`
GrowthRate float64 `json:"growth_rate"`
Forecast []ForecastPoint `json:"forecast"`
}
CostForecastResponse represents cost forecast response
type CostIntelligenceAPI ¶
type CostIntelligenceAPI struct {
// contains filtered or unexported fields
}
CostIntelligenceAPI provides REST API for cost intelligence
func NewCostIntelligenceAPI ¶
func NewCostIntelligenceAPI() *CostIntelligenceAPI
NewCostIntelligenceAPI creates a new API
func (*CostIntelligenceAPI) ServeHTTP ¶
func (api *CostIntelligenceAPI) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type CostSummaryResponse ¶
type CostSummaryResponse struct {
TotalCost float64 `json:"total_cost"`
TotalTokens int64 `json:"total_tokens"`
TotalRequests int64 `json:"total_requests"`
AvgCostPerReq float64 `json:"avg_cost_per_request"`
P95Cost float64 `json:"p95_cost"`
P99Cost float64 `json:"p99_cost"`
TimeRange string `json:"time_range"`
ChangePct float64 `json:"change_percent"`
}
CostSummaryResponse represents cost summary response
type CostTrendPoint ¶
type CostTrendPoint struct {
Timestamp time.Time `json:"timestamp"`
Cost float64 `json:"cost"`
Tokens int64 `json:"tokens"`
}
CostTrendPoint represents a cost trend data point
type CostTrendsResponse ¶
type CostTrendsResponse struct {
DataPoints []CostTrendPoint `json:"data_points"`
Trend string `json:"trend"`
ChangePct float64 `json:"change_percent"`
}
CostTrendsResponse represents cost trends response
type DailyCostPoint ¶
type DailyCostPoint struct {
Date string `json:"date"`
Cost float64 `json:"cost"`
Tokens int64 `json:"tokens"`
}
DailyCostPoint represents a daily cost point
type ExportResponse ¶
type ExportResponse struct {
URL string `json:"url"`
Format string `json:"format"`
Expires time.Time `json:"expires"`
FileSize int64 `json:"file_size"`
}
ExportResponse represents export response
type ForecastPoint ¶
ForecastPoint represents a forecast data point
type ModelComparisonData ¶
type ModelComparisonData struct {
Name string `json:"name"`
CostPerToken float64 `json:"cost_per_token"`
AvgLatency string `json:"avg_latency"`
QualityScore float64 `json:"quality_score"`
TotalRequests int64 `json:"total_requests"`
TotalCost float64 `json:"total_cost"`
ErrorRate float64 `json:"error_rate"`
}
ModelComparisonData represents model comparison data
type ModelComparisonResponse ¶
type ModelComparisonResponse struct {
Models []ModelComparisonData `json:"models"`
}
ModelComparisonResponse represents model comparison response
type TeamCostData ¶
type TeamCostData struct {
Name string `json:"name"`
Cost float64 `json:"cost"`
Requests int64 `json:"requests"`
Tokens int64 `json:"tokens"`
Change float64 `json:"change"`
}
TeamCostData represents team cost data
type TeamCostsResponse ¶
type TeamCostsResponse struct {
Teams []TeamCostData `json:"teams"`
Total float64 `json:"total"`
}
TeamCostsResponse represents team costs response