Versions in this module Expand all Collapse all v0 v0.15.0 Jul 13, 2026 v0.14.0 Jul 12, 2026 v0.13.0 Jul 6, 2026 v0.12.0 Jun 29, 2026 Changes in this version + func LoadImageConfigFromEnv() *config.ImageConfig type Config + ImageHandler ImageHandler + type CreateImageEditRequest struct + Image string + Mask string + Model string + N int + Prompt string + ResponseFormat string + Size string + User string + type CreateImageRequest struct + Model string + N int + Prompt string + Quality string + ResponseFormat string + Size string + Style string + User string + type CreateImageVariationRequest struct + Image string + Model string + N int + ResponseFormat string + Size string + User string + type ImageError struct + Code string + Message string + StatusCode int + func (e *ImageError) Error() string + type ImageHandler interface + CreateImage func(ctx context.Context, req *CreateImageRequest) (*ImageResponse, error) + CreateImageEdit func(ctx context.Context, req *CreateImageEditRequest) (*ImageResponse, error) + CreateImageVariation func(ctx context.Context, req *CreateImageVariationRequest) (*ImageResponse, error) + type ImageObject struct + B64JSON string + RevisedPrompt string + URL string + type ImageResponse struct + Created int64 + Data []ImageObject + type OmniImageHandler struct + func NewOmniImageHandler(cfg config.ImageConfig, logger *slog.Logger) (*OmniImageHandler, error) + func (h *OmniImageHandler) Close() error + func (h *OmniImageHandler) CreateImage(ctx context.Context, req *CreateImageRequest) (*ImageResponse, error) + func (h *OmniImageHandler) CreateImageEdit(ctx context.Context, req *CreateImageEditRequest) (*ImageResponse, error) + func (h *OmniImageHandler) CreateImageVariation(ctx context.Context, req *CreateImageVariationRequest) (*ImageResponse, error) type Option + func WithImageHandler(handler ImageHandler) Option type Server + func (s *Server) ToolUsageStore() *ToolUsageStore + type ToolUsageRecord struct + Latency int64 + SessionID string + Success bool + Timestamp time.Time + ToolName string + type ToolUsageStats struct + AvgLatency float64 + CallCount int64 + LastUsed time.Time + SuccessRate float64 + ToolName string + type ToolUsageStore struct + func NewToolUsageStore(maxSize int) *ToolUsageStore + func (s *ToolUsageStore) GetSummary(since, until time.Time) *ToolUsageSummary + func (s *ToolUsageStore) GetToolStats(toolName string, since, until time.Time) *ToolUsageStats + func (s *ToolUsageStore) Record(r ToolUsageRecord) + type ToolUsageSummary struct + ByTool map[string]*ToolUsageStats + TopTools []*ToolUsageStats + TotalCalls int64 v0.11.0 Jun 28, 2026 Changes in this version + const NamingSourceEchartify + const NamingSourceOmniAgent + const NamingSourceOpenAI + var ErrUnauthorized = &unauthorizedError + func CalculateCost(model string, promptTokens, completionTokens int) float64 + func GenerateCostChart(ts *UsageTimeseries) *chartir.ChartIR + func GenerateModelPieChart(summary *UsageSummary) *chartir.ChartIR + func GenerateTokensChart(ts *UsageTimeseries) *chartir.ChartIR + func GetAAuthClaims(ctx context.Context) *auth.AAuthClaims + func GetAgentAuthClaims(ctx context.Context) *auth.AgentAuthClaims + type AgentHandler interface + ChatCompletion func(ctx context.Context, req *ChatCompletionRequest) (*ChatCompletionResponse, error) + ChatCompletionStream func(ctx context.Context, req *ChatCompletionRequest, ...) error + CreateCronJob func(ctx context.Context, req *CreateCronJobRequest) (*CronJobInfo, error) + DeleteCronJob func(ctx context.Context, id string) error + DisableCronJob func(ctx context.Context, id string) error + EnableCronJob func(ctx context.Context, id string) error + GetCronJob func(ctx context.Context, id string) (*CronJobInfo, error) + GetModel func(ctx context.Context, modelID string) (*Model, error) + ListCronJobs func(ctx context.Context) ([]CronJobInfo, error) + ListModels func(ctx context.Context) ([]Model, error) + ListTools func(ctx context.Context) ([]ToolInfo, error) + TriggerCronJob func(ctx context.Context, id string) (*CronJobResult, error) + UpdateCronJob func(ctx context.Context, id string, req *UpdateCronJobRequest) (*CronJobInfo, error) + type AgentInfo struct + AllowedTools []string + CreatedAt time.Time + DeniedTools []string + Description string + Enabled bool + ID string + MaxTokens int + Model string + Name string + Provider string + SystemPrompt string + Temperature float64 + UpdatedAt time.Time + type AgentManager interface + CloneAgent func(ctx context.Context, id string, req *CloneAgentRequest) (*AgentInfo, error) + CreateAgent func(ctx context.Context, req *CreateAgentRequest) (*AgentInfo, error) + DeleteAgent func(ctx context.Context, id string) error + GetAgent func(ctx context.Context, id string) (*AgentInfo, error) + ListAgents func(ctx context.Context) ([]AgentInfo, error) + UpdateAgent func(ctx context.Context, id string, req *UpdateAgentRequest) (*AgentInfo, error) + type AgentUsage struct + AgentID string + CompletionTokens int64 + Cost float64 + PromptTokens int64 + Requests int64 + TotalTokens int64 + type ChatCompletionChunk struct + Choices []ChunkChoice + Created int64 + ID string + Model string + Object string + SystemFingerprint string + Usage *Usage + type ChatCompletionRequest struct + FrequencyPenalty *float64 + MaxTokens *int + Messages []Message + Model string + N *int + PresencePenalty *float64 + Seed *int + Stop []string + Stream bool + Temperature *float64 + ToolChoice any + Tools []Tool + TopP *float64 + User string + type ChatCompletionResponse struct + Choices []Choice + Created int64 + ID string + Model string + Object string + SystemFingerprint string + Usage *Usage + type Choice struct + FinishReason string + Index int + Logprobs any + Message Message + type ChunkChoice struct + Delta ChunkDelta + FinishReason *string + Index int + Logprobs any + type ChunkDelta struct + Content string + Role string + ToolCalls []ToolCall + type CloneAgentRequest struct + NewID string + NewName string + type Config struct + AAuth *auth.AAuthConfig + APIKeys []string + APIPrefix string + AgentAuth *auth.AgentAuthConfig + Auth *auth.Config + BaseURL string + Logger *slog.Logger + OpenAIPrefix string + PhoneNumber string + WebUI bool + type CreateAgentRequest struct + APIKey string + AllowedTools []string + BaseURL string + DeniedTools []string + Description string + ID string + MaxTokens int + Model string + Name string + Provider string + SystemPrompt string + Temperature float64 + type CreateCronJobRequest struct + Action CronActionInfo + Description string + Name string + Schedule CronScheduleInfo + type CronActionInfo struct + Message string + SessionID string + ToolName string + ToolParams map[string]any + Type string + WebhookBody string + WebhookHeaders map[string]string + WebhookMethod string + WebhookURL string + type CronJobInfo struct + Action CronActionInfo + CreatedAt time.Time + Description string + ID string + LastError string + LastRunAt *time.Time + Name string + NextRunAt *time.Time + RunCount int64 + Schedule CronScheduleInfo + Status string + UpdatedAt time.Time + type CronJobResult struct + Duration string + Error string + Output any + StartedAt string + Success bool + type CronScheduleInfo struct + Cron string + Interval string + Once string + type Error struct + Code *string + Message string + Param *string + Type string + type ErrorResponse struct + Error Error + type Function struct + Description string + Name string + Parameters map[string]interface{} + Strict bool + type FunctionCall struct + Arguments string + Name string + type MemoryCollection struct + Count int + Description string + Name string + type MemoryHandler interface + DeleteMemory func(ctx context.Context, collection, key string) error + ListCollections func(ctx context.Context) ([]MemoryCollection, error) + ListMemories func(ctx context.Context, collection string, limit int) ([]MemoryRecord, error) + SearchMemories func(ctx context.Context, collection, query string, limit int) ([]MemorySearchResult, error) + StoreMemory func(ctx context.Context, req *StoreMemoryRequest) (*MemoryRecord, error) + type MemoryRecord struct + Collection string + Content string + CreatedAt time.Time + Key string + Metadata map[string]string + type MemorySearchResult struct + Score float64 + type Message struct + Content string + Name string + Role string + ToolCallID string + ToolCalls []ToolCall + type Model struct + Created int64 + ID string + Object string + OwnedBy string + type ModelPricing struct + CompletionPer1K float64 + PromptPer1K float64 + type ModelUsage struct + CompletionTokens int64 + Cost float64 + Model string + PromptTokens int64 + Requests int64 + TotalTokens int64 + type Option func(*Config) + func WithAAuth(cfg *auth.AAuthConfig) Option + func WithAPIKeys(keys ...string) Option + func WithAPIPrefix(prefix string) Option + func WithAgentAuth(cfg *auth.AgentAuthConfig) Option + func WithAuth(cfg *auth.Config) Option + func WithBaseURL(url string) Option + func WithLogger(logger *slog.Logger) Option + func WithOpenAIPrefix(prefix string) Option + func WithPhoneNumber(phone string) Option + func WithWebUI(enabled bool) Option + type SSEWriter struct + func NewSSEWriter(w http.ResponseWriter) (*SSEWriter, error) + func (s *SSEWriter) WriteDone() error + func (s *SSEWriter) WriteError(err error) error + func (s *SSEWriter) WriteEvent(data any) error + type Server struct + func New(handler AgentHandler, opts ...Option) (*Server, error) + func (s *Server) GetMergedSpec() (any, error) + func (s *Server) Handler() http.Handler + func (s *Server) HumaAPI() huma.API + func (s *Server) ListenAndServe(addr string) error + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (s *Server) UsageStore() *UsageStore + type StoreMemoryRequest struct + Collection string + Content string + Key string + Metadata map[string]string + type StreamingHandler struct + func NewStreamingHandler(agent AgentHandler, ogenHandler http.Handler) *StreamingHandler + func (h *StreamingHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + func (h *StreamingHandler) SetUsageStore(store *UsageStore) + type Tool struct + Function Function + Type string + type ToolCall struct + Function FunctionCall + ID string + Type string + type ToolInfo struct + Category string + Description string + Name string + Parameters map[string]interface{} + type UpdateAgentRequest struct + APIKey *string + AllowedTools []string + BaseURL *string + DeniedTools []string + Description *string + Enabled *bool + MaxTokens *int + Model *string + Name *string + Provider *string + SystemPrompt *string + Temperature *float64 + type UpdateCronJobRequest struct + Action *CronActionInfo + Description *string + Name *string + Schedule *CronScheduleInfo + type Usage struct + CompletionTokens int + PromptTokens int + TotalTokens int + type UsageBucket struct + CompletionTokens int64 + Cost float64 + PromptTokens int64 + Requests int64 + Timestamp time.Time + TotalTokens int64 + type UsageHandler interface + GetUsageRecords func(ctx context.Context, limit int) ([]UsageRecord, error) + GetUsageSummary func(ctx context.Context, since, until time.Time) (*UsageSummary, error) + GetUsageTimeseries func(ctx context.Context, since, until time.Time, interval string) (*UsageTimeseries, error) + RecordUsage func(record UsageRecord) + type UsageRecord struct + AgentID string + CompletionTokens int + Cost float64 + ID string + Latency int64 + Model string + PromptTokens int + SessionID string + Timestamp time.Time + TotalTokens int + type UsageStore struct + func NewUsageStore(maxSize int) *UsageStore + func (s *UsageStore) Clear() + func (s *UsageStore) Count() int + func (s *UsageStore) GetRecords(limit int) []UsageRecord + func (s *UsageStore) GetSummary(since, until time.Time) *UsageSummary + func (s *UsageStore) GetTimeseries(since, until time.Time, interval string) *UsageTimeseries + func (s *UsageStore) Record(r UsageRecord) + type UsageSummary struct + AvgLatency float64 + ByAgent map[string]*AgentUsage + ByModel map[string]*ModelUsage + PeriodEnd time.Time + PeriodStart time.Time + TotalCompTokens int64 + TotalCost float64 + TotalPromptTokens int64 + TotalRequests int64 + TotalTokens int64 + type UsageTimeseries struct + Buckets []UsageBucket + Interval string