Documentation
¶
Overview ¶
Package admin provides the admin REST API and dashboard for GoModel.
Index ¶
- Constants
- func RequireGlobalScope() echo.MiddlewareFunc
- type DashboardConfigResponse
- type Handler
- func (h *Handler) Access(c *echo.Context) error
- func (h *Handler) AuditConversation(c *echo.Context) error
- func (h *Handler) AuditLog(c *echo.Context) error
- func (h *Handler) AuditLogDetail(c *echo.Context) error
- func (h *Handler) AuditSessions(c *echo.Context) error
- func (h *Handler) AuditStats(c *echo.Context) error
- func (h *Handler) BudgetSettings(c *echo.Context) error
- func (h *Handler) CacheOverview(c *echo.Context) error
- func (h *Handler) CreateAuthKey(c *echo.Context) error
- func (h *Handler) CreateWorkflow(c *echo.Context) error
- func (h *Handler) DailyUsage(c *echo.Context) error
- func (h *Handler) DashboardConfig(c *echo.Context) error
- func (h *Handler) DeactivateAuthKey(c *echo.Context) error
- func (h *Handler) DeactivateWorkflow(c *echo.Context) error
- func (h *Handler) DeleteBudget(c *echo.Context) error
- func (h *Handler) DeleteGuardrail(c *echo.Context) error
- func (h *Handler) DeleteMCPServer(c *echo.Context) error
- func (h *Handler) DeleteModelPricingOverride(c *echo.Context) error
- func (h *Handler) DeleteProviderCredential(c *echo.Context) error
- func (h *Handler) DeleteRateLimit(c *echo.Context) error
- func (h *Handler) DeleteUser(c *echo.Context) error
- func (h *Handler) DeleteVirtualModel(c *echo.Context) error
- func (h *Handler) GetWorkflow(c *echo.Context) error
- func (h *Handler) ListAuthKeys(c *echo.Context) error
- func (h *Handler) ListBudgets(c *echo.Context) error
- func (h *Handler) ListCategories(c *echo.Context) error
- func (h *Handler) ListGuardrailTypes(c *echo.Context) error
- func (h *Handler) ListGuardrails(c *echo.Context) error
- func (h *Handler) ListMCPServers(c *echo.Context) error
- func (h *Handler) ListModelPricingOverrides(c *echo.Context) error
- func (h *Handler) ListModels(c *echo.Context) error
- func (h *Handler) ListPlugins(c *echo.Context) error
- func (h *Handler) ListProviderCredentials(c *echo.Context) error
- func (h *Handler) ListRateLimits(c *echo.Context) error
- func (h *Handler) ListUsers(c *echo.Context) error
- func (h *Handler) ListVirtualModels(c *echo.Context) error
- func (h *Handler) ListWorkflowGuardrails(c *echo.Context) error
- func (h *Handler) ListWorkflows(c *echo.Context) error
- func (h *Handler) LiveLogs(c *echo.Context) error
- func (h *Handler) MCPServerCatalog(c *echo.Context) error
- func (h *Handler) Media(c *echo.Context) error
- func (h *Handler) ModelMetadataLayers(c *echo.Context) error
- func (h *Handler) ProviderCredentialTypes(c *echo.Context) error
- func (h *Handler) ProviderStatus(c *echo.Context) error
- func (h *Handler) RecalculateUsagePricing(c *echo.Context) error
- func (h *Handler) ReconnectMCPServer(c *echo.Context) error
- func (h *Handler) RefreshRuntime(c *echo.Context) error
- func (h *Handler) RegisterRoutes(g RouteRegistrar)
- func (h *Handler) ResetBudget(c *echo.Context) error
- func (h *Handler) ResetBudgets(c *echo.Context) error
- func (h *Handler) ResetRateLimit(c *echo.Context) error
- func (h *Handler) ResetRateLimits(c *echo.Context) error
- func (h *Handler) RuntimeSettings(c *echo.Context) error
- func (h *Handler) TaggingSettings(c *echo.Context) error
- func (h *Handler) TokenThroughput(c *echo.Context) error
- func (h *Handler) UpdateAuthKeyAllowedModels(c *echo.Context) error
- func (h *Handler) UpdateAuthKeyDashboardAccess(c *echo.Context) error
- func (h *Handler) UpdateAuthKeyLabels(c *echo.Context) error
- func (h *Handler) UpdateBudgetSettings(c *echo.Context) error
- func (h *Handler) UpdateRuntimeSetting(c *echo.Context) error
- func (h *Handler) UpdateTaggingSettings(c *echo.Context) error
- func (h *Handler) UpsertBudget(c *echo.Context) error
- func (h *Handler) UpsertGuardrail(c *echo.Context) error
- func (h *Handler) UpsertMCPServer(c *echo.Context) error
- func (h *Handler) UpsertModelPricingOverride(c *echo.Context) error
- func (h *Handler) UpsertProviderCredential(c *echo.Context) error
- func (h *Handler) UpsertRateLimit(c *echo.Context) error
- func (h *Handler) UpsertUser(c *echo.Context) error
- func (h *Handler) UpsertVirtualModel(c *echo.Context) error
- func (h *Handler) UsageByLabel(c *echo.Context) error
- func (h *Handler) UsageByModel(c *echo.Context) error
- func (h *Handler) UsageBySession(c *echo.Context) error
- func (h *Handler) UsageByUserPath(c *echo.Context) error
- func (h *Handler) UsageLog(c *echo.Context) error
- func (h *Handler) UsageSummary(c *echo.Context) error
- type MCPServerAdmin
- type Option
- func WithAuditReader(reader auditlog.Reader) Option
- func WithAuthKeys(service *authkeys.Service) Option
- func WithBudgets(service *budget.Service) Option
- func WithConfiguredProviders(configs []providers.SanitizedProviderConfig) Option
- func WithDashboardRuntimeConfig(values DashboardConfigResponse) Option
- func WithGuardrailService(service *guardrails.Service) Option
- func WithLiveBroker(broker *live.Broker) Option
- func WithMCPServers(service MCPServerAdmin) Option
- func WithMediaStore(store *mediastore.Service) Option
- func WithPluginCatalog(catalog *plugins.Catalog) Option
- func WithPricingOverrides(service *pricingoverrides.Service) Option
- func WithPricingResolver(resolver usage.PricingResolver) Option
- func WithProviderCredentials(service ProviderCredentialsAdmin) Option
- func WithQuotaTemplatesEnabled(enabled bool) Option
- func WithRateLimits(service *ratelimit.Service) Option
- func WithRequestHealth(source RequestHealthSource) Option
- func WithRuntimeRefresher(refresher RuntimeRefresher) Option
- func WithRuntimeSettings(settings *runtimesettings.Service) Option
- func WithTagging(service *tagging.Service) Option
- func WithUsagePricingRecalculator(recalculator usage.PricingRecalculator) Option
- func WithUsers(service *users.Service) Option
- func WithVirtualModels(service *virtualmodels.Service) Option
- func WithWorkflows(service *workflows.Service) Option
- type ProviderCredentialsAdmin
- type RequestHealthSource
- type RouteRegistrar
- type RuntimeRefreshReport
- type RuntimeRefreshStep
- type RuntimeRefresher
Constants ¶
const ( DashboardConfigDemoMode = "DEMO_MODE" DashboardConfigFailoverEnabled = "FAILOVER_ENABLED" DashboardConfigLoggingEnabled = "LOGGING_ENABLED" DashboardConfigLoggingRetentionDays = "LOGGING_RETENTION_DAYS" DashboardConfigUsageEnabled = "USAGE_ENABLED" DashboardConfigBudgetsEnabled = "BUDGETS_ENABLED" DashboardConfigRateLimitsEnabled = "RATE_LIMITS_ENABLED" DashboardConfigQuotaTemplates = "PER_CHILD_QUOTAS_ENABLED" DashboardConfigGuardrailsEnabled = "GUARDRAILS_ENABLED" DashboardConfigPluginsEnabled = "PLUGINS_ENABLED" DashboardConfigCacheEnabled = "CACHE_ENABLED" DashboardConfigRedisURL = "REDIS_URL" DashboardConfigSemanticCacheEnabled = "SEMANTIC_CACHE_ENABLED" DashboardConfigPricingRecalculation = "USAGE_PRICING_RECALCULATION_ENABLED" DashboardConfigLiveLogsEnabled = "DASHBOARD_LIVE_LOGS_ENABLED" DashboardConfigMCPEnabled = "MCP_ENABLED" DashboardConfigVMStrategies = "VIRTUAL_MODEL_STRATEGIES" DashboardConfigUserPathHeader = "USER_PATH_HEADER" )
const ( RuntimeRefreshStatusOK = "ok" RuntimeRefreshStatusPartial = "partial" RuntimeRefreshStatusFailed = "failed" RuntimeRefreshStatusSkipped = "skipped" )
Variables ¶
This section is empty.
Functions ¶
func RequireGlobalScope ¶ added in v0.1.87
func RequireGlobalScope() echo.MiddlewareFunc
RequireGlobalScope rejects requests from user-path scoped credentials with 403 admin_scope_denied. Mount it on gateway-wide endpoints.
Types ¶
type DashboardConfigResponse ¶
type DashboardConfigResponse struct {
DemoMode string `json:"DEMO_MODE,omitempty"`
FailoverEnabled string `json:"FAILOVER_ENABLED,omitempty"`
LoggingEnabled string `json:"LOGGING_ENABLED,omitempty"`
LoggingRetentionDays string `json:"LOGGING_RETENTION_DAYS,omitempty"`
UsageEnabled string `json:"USAGE_ENABLED,omitempty"`
BudgetsEnabled string `json:"BUDGETS_ENABLED,omitempty"`
RateLimitsEnabled string `json:"RATE_LIMITS_ENABLED,omitempty"`
QuotaTemplatesEnabled string `json:"PER_CHILD_QUOTAS_ENABLED,omitempty"`
GuardrailsEnabled string `json:"GUARDRAILS_ENABLED,omitempty"`
PluginsEnabled string `json:"PLUGINS_ENABLED,omitempty"`
CacheEnabled string `json:"CACHE_ENABLED,omitempty"`
RedisURL string `json:"REDIS_URL,omitempty"`
SemanticCacheEnabled string `json:"SEMANTIC_CACHE_ENABLED,omitempty"`
PricingRecalculation string `json:"USAGE_PRICING_RECALCULATION_ENABLED,omitempty"`
LiveLogsEnabled string `json:"DASHBOARD_LIVE_LOGS_ENABLED,omitempty"`
MCPEnabled string `json:"MCP_ENABLED,omitempty"`
// VirtualModelStrategies is the comma-separated list of load-balancing
// strategies this deployment supports. "adaptive" appears only when a
// route-selector extension is registered, so the dashboard never offers
// a strategy that would silently fall back to round robin.
VirtualModelStrategies string `json:"VIRTUAL_MODEL_STRATEGIES,omitempty"`
// UserPathHeader is the canonical name of the inbound header the gateway
// reads user paths from (server.user_path_header), so the Playground sends
// the header this deployment actually honors.
UserPathHeader string `json:"USER_PATH_HEADER,omitempty"`
}
DashboardConfigResponse is the allowlisted runtime config contract exposed to the dashboard UI.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves admin API endpoints.
func NewHandler ¶
func NewHandler(reader usage.UsageReader, registry *providers.ModelRegistry, options ...Option) *Handler
NewHandler creates a new admin API handler. usageReader may be nil if usage tracking is not available.
func (*Handler) Access ¶ added in v0.1.87
Access handles GET /admin/access.
@Summary Describe the caller's admin scope @Description Reports whether the credential administers the whole gateway @Description or only one user-path subtree, so clients can adapt what @Description they offer before hitting scoped endpoints. @Tags admin @Produce json @Security BearerAuth @Success 200 {object} accessResponse @Failure 401 {object} core.GatewayError @Router /admin/access [get]
func (*Handler) AuditConversation ¶
AuditConversation handles GET /admin/audit/conversation
@Summary Get the interaction session containing an audit log entry @Description Thread entries carry the request/response bodies the @Description transcript is built from; attempts, request revisions, and @Description response headers are omitted; redacted request headers and @Description per-request usage summaries are retained for continuation @Description and prompt-cache visualization. @Tags admin @Produce json @Security BearerAuth @Param log_id query string true "Anchor audit log entry ID" @Param limit query int false "Max entries in thread (default 40, max 200)" @Success 200 {object} auditConversationResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/audit/conversation [get]
func (*Handler) AuditLog ¶
AuditLog handles GET /admin/audit/log
@Summary Get paginated audit log entries @Description Entries are slimmed for the wire: request/response bodies, @Description per-attempt error bodies, and rewritten revision bodies are @Description omitted (bodies_omitted=true). Fetch /admin/audit/detail for @Description the full payload of one entry. @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param requested_model query string false "Filter by requested model selector" @Param provider query string false "Filter by provider name or provider type" @Param method query string false "Filter by HTTP method" @Param path query string false "Filter by request path" @Param user_path query string false "Filter by tracked user path subtree" @Param session_id query string false "Filter by exact session id" @Param error_type query string false "Filter by error type" @Param status_code query int false "Filter by status code" @Param stream query bool false "Filter by stream mode (true/false)" @Param exclude_operation query string false "Comma-separated endpoint operations to hide, e.g. mcp,provider_passthrough,audio_speech; other entries, including unclassified ones, stay" @Param search query string false "Search across request_id/requested_model/provider/method/path/session_id/error_type/error_message" @Param limit query int false "Page size (default 25, max 100)" @Param offset query int false "Offset for pagination" @Success 200 {object} auditLogListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/audit/log [get]
func (*Handler) AuditLogDetail ¶
AuditLogDetail handles GET /admin/audit/detail.
@Summary Get audit log entry detail @Description Returns one audit log entry enriched with usage summary when available. @Tags admin @Produce json @Security BearerAuth @Param log_id query string true "Audit log entry ID" @Success 200 {object} auditLogEntryResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 500 {object} core.GatewayError @Router /admin/audit/detail [get]
func (*Handler) AuditSessions ¶ added in v0.1.63
AuditSessions handles GET /admin/audit/sessions
@Summary Get paginated audit sessions (threads) @Description Groups audit log entries by session id into threads and returns @Description one summary per thread — its latest matching entry and complete @Description request count — ordered by latest activity. Entries without a session id @Description appear as single-entry threads. Filters apply to entries before @Description grouping. @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param requested_model query string false "Filter by requested model selector" @Param provider query string false "Filter by provider name or provider type" @Param method query string false "Filter by HTTP method" @Param path query string false "Filter by request path" @Param user_path query string false "Filter by tracked user path subtree" @Param error_type query string false "Filter by error type" @Param status_code query int false "Filter by status code" @Param stream query bool false "Filter by stream mode (true/false)" @Param exclude_operation query string false "Comma-separated endpoint operations to hide, e.g. mcp,provider_passthrough,audio_speech; other entries, including unclassified ones, stay" @Param search query string false "Search across request_id/requested_model/provider/method/path/session_id/error_type/error_message" @Param limit query int false "Page size in threads (default 25, max 100)" @Param offset query int false "Offset for pagination" @Success 200 {object} auditSessionsListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/audit/sessions [get]
func (*Handler) AuditStats ¶
AuditStats handles GET /admin/audit/stats
@Summary Get time-bucketed request status and latency stats @Description Returns request counts grouped into 2xx/4xx/5xx status classes @Description per time bucket, an overall success-rate summary, and average @Description request duration per provider for the dashboard charts. @Description Ranges up to 3 days use hourly buckets, longer ranges daily. @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param user_path query string false "Filter by tracked user path subtree" @Success 200 {object} auditlog.RequestStats @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/audit/stats [get]
func (*Handler) BudgetSettings ¶
BudgetSettings handles GET /admin/budgets/settings. @Summary Get budget reset settings @Tags admin @Produce json @Security BearerAuth @Success 200 {object} budget.Settings @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets/settings [get]
func (*Handler) CacheOverview ¶
CacheOverview handles GET /admin/cache/overview
@Summary Get cached-only usage overview @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param interval query string false "Grouping interval: daily, weekly, monthly, yearly (default daily)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (cache overview always uses cached mode)" @Success 200 {object} usage.CacheOverview @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/cache/overview [get]
func (*Handler) CreateAuthKey ¶
CreateAuthKey handles POST /admin/auth-keys
func (*Handler) CreateWorkflow ¶
CreateWorkflow handles POST /admin/workflows
func (*Handler) DailyUsage ¶
DailyUsage handles GET /admin/usage/daily
@Summary Get usage breakdown by period @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param interval query string false "Grouping interval: daily, weekly, monthly, yearly (default daily)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Success 200 {array} usage.DailyUsage @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/daily [get]
func (*Handler) DashboardConfig ¶
DashboardConfig handles GET /admin/runtime/config
@Summary Get admin runtime configuration @Tags admin @Produce json @Security BearerAuth @Success 200 {object} DashboardConfigResponse @Failure 401 {object} core.GatewayError @Router /admin/runtime/config [get]
func (*Handler) DeactivateAuthKey ¶
DeactivateAuthKey handles POST /admin/auth-keys/:id/deactivate
func (*Handler) DeactivateWorkflow ¶
DeactivateWorkflow handles POST /admin/workflows/:id/deactivate
func (*Handler) DeleteBudget ¶
DeleteBudget handles DELETE /admin/budgets. @Summary Delete one budget @Tags admin @Accept json @Produce json @Security BearerAuth @Param budget body deleteBudgetRequest true "Budget key" @Success 200 {object} budgetListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets [delete]
func (*Handler) DeleteGuardrail ¶
DeleteGuardrail handles DELETE /admin/guardrails
func (*Handler) DeleteMCPServer ¶
DeleteMCPServer handles DELETE /admin/mcp-servers/:name.
@Summary Delete one admin-managed MCP server @Tags admin @Produce json @Security BearerAuth @Param name path string true "MCP server slug" @Success 204 "No Content" @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/mcp-servers/{name} [delete]
func (*Handler) DeleteModelPricingOverride ¶
DeleteModelPricingOverride handles DELETE /admin/model-pricing-overrides.
@Summary Delete one model pricing override @Tags admin @Accept json @Produce json @Security BearerAuth @Param request body deleteModelPricingOverrideRequest true "Pricing selector to remove" @Success 204 "No Content" @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/model-pricing-overrides [delete]
func (*Handler) DeleteProviderCredential ¶ added in v0.1.56
DeleteProviderCredential handles DELETE /admin/provider-credentials/:name.
@Summary Delete one admin-managed provider credential @Tags admin @Produce json @Security BearerAuth @Param name path string true "Provider name" @Success 204 "No Content" @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/provider-credentials/{name} [delete]
func (*Handler) DeleteRateLimit ¶
DeleteRateLimit handles DELETE /admin/rate-limits. @Summary Delete one rate limit rule @Tags admin @Accept json @Produce json @Security BearerAuth @Param rule body deleteRateLimitRequest true "Rate limit key" @Success 200 {object} rateLimitListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/rate-limits [delete]
func (*Handler) DeleteUser ¶ added in v0.1.84
DeleteUser handles DELETE /admin/users?user_path=...
func (*Handler) DeleteVirtualModel ¶
DeleteVirtualModel handles DELETE /admin/virtual-models.
@Summary Delete one virtual model @Tags admin @Accept json @Produce json @Security BearerAuth @Param request body deleteVirtualModelRequest true "Virtual model source to remove" @Success 204 "No Content" @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/virtual-models [delete]
func (*Handler) GetWorkflow ¶
GetWorkflow handles GET /admin/workflows/:id
func (*Handler) ListBudgets ¶
ListBudgets handles GET /admin/budgets.
@Summary List budgets with current status @Tags admin @Produce json @Security BearerAuth @Success 200 {object} budgetListResponse @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets [get]
func (*Handler) ListCategories ¶
ListCategories handles GET /admin/models/categories
@Summary List model categories with counts @Tags admin @Produce json @Security BearerAuth @Success 200 {array} providers.CategoryCount @Failure 401 {object} core.GatewayError @Router /admin/models/categories [get]
func (*Handler) ListGuardrails ¶
ListGuardrails handles GET /admin/guardrails
func (*Handler) ListMCPServers ¶
ListMCPServers handles GET /admin/mcp-servers.
@Summary List MCP servers (config-declared and admin-managed) @Tags admin @Produce json @Security BearerAuth @Success 200 {array} mcpServerViewResponse @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/mcp-servers [get]
func (*Handler) ListModelPricingOverrides ¶
ListModelPricingOverrides handles GET /admin/model-pricing-overrides.
@Summary List model pricing overrides @Description Lists persisted USD pricing overrides. Selectors support global "/", provider-wide "provider/", model-wide "model", and exact "provider/model" scopes. @Tags admin @Produce json @Security BearerAuth @Success 200 {array} pricingoverrides.View @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/model-pricing-overrides [get]
func (*Handler) ListModels ¶
ListModels handles GET /admin/models Supports optional ?category= query param for filtering by model category.
@Summary List all registered models with provider info and access state @Tags admin @Produce json @Security BearerAuth @Param category query string false "Filter by model category" @Success 200 {array} modelInventoryResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Router /admin/models [get]
func (*Handler) ListPlugins ¶ added in v0.1.90
ListPlugins handles GET /admin/plugins: every loaded plugin type with its manifest, hook kinds, config schema, source and health.
func (*Handler) ListProviderCredentials ¶ added in v0.1.56
ListProviderCredentials handles GET /admin/provider-credentials.
@Summary List admin-managed model provider credentials @Tags admin @Produce json @Security BearerAuth @Success 200 {array} providerCredentialViewResponse @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/provider-credentials [get]
func (*Handler) ListRateLimits ¶
ListRateLimits handles GET /admin/rate-limits.
@Summary List rate limit rules with live counter status @Tags admin @Produce json @Security BearerAuth @Success 200 {object} rateLimitListResponse @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/rate-limits [get]
func (*Handler) ListUsers ¶ added in v0.1.84
ListUsers handles GET /admin/users. It returns the user-path tree derived from stored policies and managed auth keys, each node with its own allowlist and the ancestors that restrict it.
func (*Handler) ListVirtualModels ¶
ListVirtualModels handles GET /admin/virtual-models.
@Summary List virtual models (redirects and access policies) @Tags admin @Produce json @Security BearerAuth @Success 200 {array} virtualmodels.View @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/virtual-models [get]
func (*Handler) ListWorkflowGuardrails ¶
ListWorkflowGuardrails handles GET /admin/workflows/guardrails
func (*Handler) MCPServerCatalog ¶
MCPServerCatalog handles GET /admin/mcp-servers/:name/catalog.
@Summary Inspect one MCP server's current catalog @Description Lists the tools, prompts, resources, and resource templates the named server currently exposes through the gateway, after operator tool filters. Discovered tools the filters hide are listed separately under excluded_tools. Names are the upstream originals; the aggregated /mcp endpoint prefixes them with the server slug. @Tags admin @Produce json @Security BearerAuth @Param name path string true "MCP server slug" @Success 200 {object} mcpgateway.CatalogView @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/mcp-servers/{name}/catalog [get]
func (*Handler) Media ¶ added in v0.1.96
Media handles GET /admin/media/:id
@Summary Download a stored media object @Description Streams the bytes of an audio or image object the audit log @Description references by media_id, with its content type. Range requests @Description are honored so browser players can seek. An object outside the @Description caller's user-path scope is reported as missing. @Tags admin @Security BearerAuth @Produce octet-stream @Param id path string true "Media object id" @Success 200 {file} file @Success 206 {file} file @Failure 400 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/media/{id} [get]
func (*Handler) ModelMetadataLayers ¶ added in v0.1.96
ModelMetadataLayers handles GET /admin/models/metadata
@Summary Show where one model's metadata comes from @Description Returns the merged metadata the gateway serves for a model together with each layer it was merged from: the provider's own listing, the model catalog entry and the config.yaml override. A null layer knows nothing about the model. `sources` names the winning layer per field (config, provider, catalog or inferred). @Tags admin @Produce json @Security BearerAuth @Param provider query string true "Provider instance name or provider type" @Param model query string true "Raw upstream model ID" @Success 200 {object} providers.ModelMetadataLayers @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Router /admin/models/metadata [get]
func (*Handler) ProviderCredentialTypes ¶ added in v0.1.56
ProviderCredentialTypes handles GET /admin/provider-credentials/types.
@Summary List provider types the gateway can construct, with their credential forms @Description Each entry names a constructible provider type and the credential fields it accepts, so a client offers only the fields that type uses. @Tags admin @Produce json @Security BearerAuth @Success 200 {array} providerCredentialTypeResponse @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/provider-credentials/types [get]
func (*Handler) RecalculateUsagePricing ¶
RecalculateUsagePricing handles POST /admin/usage/recalculate-pricing.
@Summary Recalculate stored usage costs from current model pricing metadata @Tags admin @Accept json @Produce json @Security BearerAuth @Param request body recalculatePricingRequest true "Recalculation filters and confirmation" @Success 200 {object} usage.RecalculatePricingResult @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 500 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/usage/recalculate-pricing [post]
func (*Handler) ReconnectMCPServer ¶
ReconnectMCPServer handles POST /admin/mcp-servers/:name/reconnect. The action succeeds even when the upstream stays down: the refreshed view then carries the degraded status and last_error. Only an unknown name is a 404.
@Summary Force-redial one MCP server and return its fresh state @Tags admin @Produce json @Security BearerAuth @Param name path string true "MCP server slug" @Success 200 {object} mcpServerViewResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 404 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/mcp-servers/{name}/reconnect [post]
func (*Handler) RefreshRuntime ¶
RefreshRuntime handles POST /admin/runtime/refresh
func (*Handler) RegisterRoutes ¶
func (h *Handler) RegisterRoutes(g RouteRegistrar)
RegisterRoutes mounts the admin REST API on the given route group. Callers typically pass an *echo.Group rooted at /admin.
Routes carrying the global middleware are gateway-wide: user-path scoped credentials get 403 admin_scope_denied there. Every other route either serves tenant data filtered to the caller's scope or is harmless metadata.
func (*Handler) ResetBudget ¶
ResetBudget handles POST /admin/budgets/reset-one. @Summary Reset one budget period @Tags admin @Accept json @Produce json @Security BearerAuth @Param budget body resetBudgetRequest true "Budget key" @Success 200 {object} budgetListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets/reset-one [post]
func (*Handler) ResetBudgets ¶
ResetBudgets handles POST /admin/budgets/reset. @Summary Reset all budget periods @Tags admin @Accept json @Produce json @Security BearerAuth @Param confirmation body resetBudgetsRequest true "Reset confirmation" @Success 200 {object} resetBudgetsResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets/reset [post]
func (*Handler) ResetRateLimit ¶
ResetRateLimit handles POST /admin/rate-limits/reset-one. @Summary Reset the live counters of one rate limit rule @Tags admin @Accept json @Produce json @Security BearerAuth @Param rule body resetRateLimitRequest true "Rate limit key" @Success 200 {object} rateLimitListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/rate-limits/reset-one [post]
func (*Handler) ResetRateLimits ¶
ResetRateLimits handles POST /admin/rate-limits/reset. @Summary Reset the live counters of all rate limit rules @Tags admin @Accept json @Produce json @Security BearerAuth @Param confirmation body resetRateLimitsRequest true "Reset confirmation" @Success 200 {object} resetRateLimitsResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/rate-limits/reset [post]
func (*Handler) RuntimeSettings ¶ added in v0.1.69
RuntimeSettings lists extension-defined settings for the Dashboard.
func (*Handler) TaggingSettings ¶
TaggingSettings handles GET /admin/tagging/settings. @Summary Get header tagging rules @Tags admin @Produce json @Security BearerAuth @Success 200 {object} taggingSettingsResponse @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/tagging/settings [get]
func (*Handler) TokenThroughput ¶
TokenThroughput handles GET /admin/usage/throughput.
@Summary Get the live token-throughput window @Description Returns a fixed, trailing window of token-volume buckets @Description (input / output / prompt-cached / locally-cached) at the @Description requested granularity, for the overview live chart. @Tags admin @Produce json @Security BearerAuth @Param granularity query string true "Bucket granularity: second, minute, hour, day" @Success 200 {object} usage.TokenThroughput @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/throughput [get]
func (*Handler) UpdateAuthKeyAllowedModels ¶ added in v0.1.84
UpdateAuthKeyAllowedModels handles PUT /admin/auth-keys/:id/allowed-models. The request selectors replace the key's model allowlist; an explicit empty list lifts the key-level restriction (user-path policies still apply).
func (*Handler) UpdateAuthKeyDashboardAccess ¶ added in v0.1.59
UpdateAuthKeyDashboardAccess handles PUT /admin/auth-keys/:id/dashboard-access. It grants or revokes the key's access to the admin API and dashboard.
func (*Handler) UpdateAuthKeyLabels ¶
UpdateAuthKeyLabels handles PUT /admin/auth-keys/:id/labels. The request labels replace the key's labels; an empty list clears them.
func (*Handler) UpdateBudgetSettings ¶
UpdateBudgetSettings handles PUT /admin/budgets/settings. @Summary Update budget reset settings @Tags admin @Accept json @Produce json @Security BearerAuth @Param settings body updateBudgetSettingsRequest true "Budget reset settings" @Success 200 {object} budget.Settings @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets/settings [put]
func (*Handler) UpdateRuntimeSetting ¶ added in v0.1.69
UpdateRuntimeSetting validates and persists one extension-defined setting.
func (*Handler) UpdateTaggingSettings ¶
UpdateTaggingSettings handles PUT /admin/tagging/settings. The request replaces the operator-managed rule set; config/env-declared rules are read-only and rejected. @Summary Replace operator header tagging rules @Tags admin @Accept json @Produce json @Security BearerAuth @Param settings body updateTaggingSettingsRequest true "Operator tagging rules" @Success 200 {object} taggingSettingsResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/tagging/settings [put]
func (*Handler) UpsertBudget ¶
UpsertBudget handles PUT /admin/budgets. @Summary Create or update one budget @Tags admin @Accept json @Produce json @Security BearerAuth @Param budget body upsertBudgetRequest true "Budget key and amount" @Success 200 {object} budgetListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/budgets [put]
func (*Handler) UpsertGuardrail ¶
UpsertGuardrail handles PUT /admin/guardrails
func (*Handler) UpsertMCPServer ¶
UpsertMCPServer handles PUT /admin/mcp-servers.
@Summary Create or update one admin-managed MCP server @Tags admin @Accept json @Produce json @Security BearerAuth @Param mcp_server body upsertMCPServerRequest true "MCP server definition" @Success 200 {object} mcpServerViewResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/mcp-servers [put]
func (*Handler) UpsertModelPricingOverride ¶
UpsertModelPricingOverride handles PUT /admin/model-pricing-overrides.
@Summary Create or update one model pricing override @Description Stores USD-only pricing for one selector. More precise selectors override broader selectors at runtime. @Tags admin @Accept json @Produce json @Security BearerAuth @Param override body upsertModelPricingOverrideRequest true "Pricing selector and override" @Success 200 {object} pricingoverrides.View @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 500 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/model-pricing-overrides [put]
func (*Handler) UpsertProviderCredential ¶ added in v0.1.56
UpsertProviderCredential handles PUT /admin/provider-credentials.
@Summary Create or update one admin-managed provider credential @Description Registers (or re-registers) the provider into the running gateway immediately, without a restart. @Tags admin @Accept json @Produce json @Security BearerAuth @Param provider body upsertProviderCredentialRequest true "Provider credential definition" @Success 200 {object} providerCredentialViewResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/provider-credentials [put]
func (*Handler) UpsertRateLimit ¶
UpsertRateLimit handles PUT /admin/rate-limits. @Summary Create or update one rate limit rule @Tags admin @Accept json @Produce json @Security BearerAuth @Param rule body upsertRateLimitRequest true "Rate limit key and limits" @Success 200 {object} rateLimitListResponse @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/rate-limits [put]
func (*Handler) UpsertUser ¶ added in v0.1.84
UpsertUser handles PUT /admin/users.
func (*Handler) UpsertVirtualModel ¶
UpsertVirtualModel handles PUT /admin/virtual-models. When old_source is set and differs from source, the row is renamed: stored under the new source and removed from the old one in a single validated operation.
@Summary Create, update, or rename one virtual model @Tags admin @Accept json @Produce json @Security BearerAuth @Param virtual_model body upsertVirtualModelRequest true "Virtual model definition" @Success 200 {object} virtualmodels.View @Success 204 "No-op access policy removed" @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 502 {object} core.GatewayError @Failure 503 {object} core.GatewayError @Router /admin/virtual-models [put]
func (*Handler) UsageByLabel ¶
UsageByLabel handles GET /admin/usage/labels
@Summary Get usage breakdown by request label @Description Returns per-label token and cost aggregates. Requests carrying @Description several labels count once per label, so rows overlap and do @Description not sum to the period totals. Unlabelled requests are omitted. @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Success 200 {array} usage.LabelUsage @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/labels [get]
func (*Handler) UsageByModel ¶
UsageByModel handles GET /admin/usage/models
@Summary Get usage breakdown by model @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Success 200 {array} usage.ModelUsage @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/models [get]
func (*Handler) UsageBySession ¶ added in v0.1.76
UsageBySession handles GET /admin/usage/sessions
@Summary Get usage breakdown by detected session @Description Returns a bounded page of request, token, and cost aggregates @Description for detected, user-path-scoped sessions. Requests and tokens @Description include local-cache hits; costs represent provider spend only. @Description Usage without a detected session is omitted. @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param limit query int false "Page size (default 50, max 200)" @Param offset query int false "Offset for pagination" @Success 200 {object} usage.SessionUsageResult @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/sessions [get]
func (*Handler) UsageByUserPath ¶
UsageByUserPath handles GET /admin/usage/user-paths
@Summary Get usage breakdown by user path @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Success 200 {array} usage.UserPathUsage @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/user-paths [get]
func (*Handler) UsageLog ¶
UsageLog handles GET /admin/usage/log
@Summary Get paginated usage log entries @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Param session_id query string false "Filter by exact detected session ID" @Param search query string false "Search across model, provider, request_id, provider_id, session_id" @Param limit query int false "Page size (default 50, max 200)" @Param offset query int false "Offset for pagination" @Success 200 {object} usage.UsageLogResult @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/log [get]
func (*Handler) UsageSummary ¶
UsageSummary handles GET /admin/usage/summary
@Summary Get usage summary @Tags admin @Produce json @Security BearerAuth @Param days query int false "Number of days (default 30)" @Param start_date query string false "Start date (YYYY-MM-DD)" @Param end_date query string false "End date (YYYY-MM-DD)" @Param model query string false "Filter by exact model name" @Param provider query string false "Filter by provider name or provider type" @Param label query string false "Filter by request label (exact match)" @Param session_id query string false "Filter by exact detected session ID" @Param user_path query string false "Filter by tracked user path subtree" @Param cache_mode query string false "Cache mode filter: uncached, cached, all (default uncached)" @Success 200 {object} usage.UsageSummary @Failure 400 {object} core.GatewayError @Failure 401 {object} core.GatewayError @Failure 403 {object} core.GatewayError @Router /admin/usage/summary [get]
type MCPServerAdmin ¶
type MCPServerAdmin interface {
Views() []mcpgateway.ServerView
IsManaged(name string) bool
GetManaged(ctx context.Context, name string) (*mcpgateway.ManagedServer, error)
Upsert(ctx context.Context, server mcpgateway.ManagedServer) error
Delete(ctx context.Context, name string) error
Reconnect(ctx context.Context, name string) (mcpgateway.ServerView, error)
Catalog(name string) (mcpgateway.CatalogView, bool)
}
MCPServerAdmin is the narrow surface of *mcpgateway.Service the admin API needs, kept as an interface so handler tests can stub the gateway without dialing upstream servers.
type Option ¶
type Option func(*Handler)
Option configures the admin API handler.
func WithAuditReader ¶
WithAuditReader enables audit log read endpoints.
func WithAuthKeys ¶
WithAuthKeys enables managed auth key administration endpoints.
func WithBudgets ¶
WithBudgets enables budget administration endpoints.
func WithConfiguredProviders ¶
func WithConfiguredProviders(configs []providers.SanitizedProviderConfig) Option
WithConfiguredProviders enables the admin-safe provider inventory endpoint.
func WithDashboardRuntimeConfig ¶
func WithDashboardRuntimeConfig(values DashboardConfigResponse) Option
WithDashboardRuntimeConfig enables the allowlisted dashboard runtime config endpoint.
func WithGuardrailService ¶
func WithGuardrailService(service *guardrails.Service) Option
WithGuardrailService enables full guardrail definition administration endpoints. A nil service (plugin system disabled) leaves them unavailable rather than storing a nil pointer behind the interfaces.
func WithLiveBroker ¶
WithLiveBroker enables realtime dashboard log previews.
func WithMCPServers ¶
func WithMCPServers(service MCPServerAdmin) Option
WithMCPServers enables MCP server administration endpoints. Callers must not wrap a nil *mcpgateway.Service (a typed nil would defeat the handlers' feature-unavailable check).
func WithMediaStore ¶ added in v0.1.96
func WithMediaStore(store *mediastore.Service) Option
WithMediaStore enables GET /admin/media/{id}, which serves the audio and images the audit log references by media id.
func WithPluginCatalog ¶ added in v0.1.90
WithPluginCatalog enables the plugin listing endpoint.
func WithPricingOverrides ¶
func WithPricingOverrides(service *pricingoverrides.Service) Option
WithPricingOverrides enables model pricing override administration endpoints.
func WithPricingResolver ¶
func WithPricingResolver(resolver usage.PricingResolver) Option
WithPricingResolver sets the resolver used for usage pricing recalculation.
func WithProviderCredentials ¶ added in v0.1.56
func WithProviderCredentials(service ProviderCredentialsAdmin) Option
WithProviderCredentials enables admin management of model provider credentials (the dashboard alternative to setting provider API keys as env vars). Callers must not wrap a nil *providers.CredentialsService (a typed nil would defeat the handlers' feature-unavailable check).
func WithQuotaTemplatesEnabled ¶ added in v0.1.77
WithQuotaTemplatesEnabled controls whether admin writes may create per-child budget and rate-limit templates.
func WithRateLimits ¶
WithRateLimits enables rate limit administration endpoints.
func WithRequestHealth ¶
func WithRequestHealth(source RequestHealthSource) Option
WithRequestHealth folds recent request outcomes (per-model errors and the live circuit-breaker state) into the provider status endpoint.
func WithRuntimeRefresher ¶
func WithRuntimeRefresher(refresher RuntimeRefresher) Option
WithRuntimeRefresher enables manual runtime refresh from the admin API.
func WithRuntimeSettings ¶ added in v0.1.69
func WithRuntimeSettings(settings *runtimesettings.Service) Option
WithRuntimeSettings enables deployment-wide extension settings.
func WithTagging ¶
WithTagging wires the header tagging service for label rule management.
func WithUsagePricingRecalculator ¶
func WithUsagePricingRecalculator(recalculator usage.PricingRecalculator) Option
WithUsagePricingRecalculator enables persisted usage pricing recalculation.
func WithUsers ¶ added in v0.1.84
WithUsers enables user (user-path) access policy administration endpoints.
func WithVirtualModels ¶
func WithVirtualModels(service *virtualmodels.Service) Option
WithVirtualModels enables unified virtual model administration endpoints.
func WithWorkflows ¶
WithWorkflows enables workflow administration endpoints.
type ProviderCredentialsAdmin ¶ added in v0.1.56
type ProviderCredentialsAdmin interface {
List(ctx context.Context) ([]providers.ManagedProviderCredential, error)
Get(ctx context.Context, name string) (*providers.ManagedProviderCredential, error)
Upsert(ctx context.Context, cred providers.ManagedProviderCredential) error
Delete(ctx context.Context, name string) error
IsManaged(name string) bool
RegisteredTypes() []string
CredentialSchemas() []providers.CredentialSchema
// ConfiguredProviders returns the effective, admin-safe configuration of
// every credential currently installed in the registry.
ConfiguredProviders() []providers.SanitizedProviderConfig
}
ProviderCredentialsAdmin is the narrow surface of *providers.CredentialsService the admin API needs, kept as an interface so handler tests can stub it.
type RequestHealthSource ¶
type RequestHealthSource interface {
Snapshot() map[string]health.ProviderHealth
}
RequestHealthSource supplies windowed real-traffic health per provider, keyed by configured provider name.
type RouteRegistrar ¶
type RouteRegistrar interface {
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
}
RouteRegistrar is the subset of *echo.Group / *echo.Echo that RegisterRoutes uses. Decoupling from a concrete echo type keeps the admin package useful for callers that want to mount the API under a different path prefix or wrap the routes with extra middleware.
type RuntimeRefreshReport ¶
type RuntimeRefreshReport struct {
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
FinishedAt time.Time `json:"finished_at"`
DurationMS int64 `json:"duration_ms"`
ModelCount int `json:"model_count"`
ProviderCount int `json:"provider_count"`
Steps []RuntimeRefreshStep `json:"steps"`
}
RuntimeRefreshReport is returned by the manual runtime refresh endpoint.
type RuntimeRefreshStep ¶
type RuntimeRefreshStep struct {
Name string `json:"name"`
Status string `json:"status"`
Message string `json:"message,omitempty"`
Error string `json:"error,omitempty"`
DurationMS int64 `json:"duration_ms"`
}
RuntimeRefreshStep describes the result of one manual runtime refresh step.
type RuntimeRefresher ¶
type RuntimeRefresher interface {
RefreshRuntime(ctx context.Context) (RuntimeRefreshReport, error)
}
RuntimeRefresher refreshes application runtime snapshots on demand.
Source Files
¶
- audit_projection.go
- errors.go
- handler.go
- handler_access.go
- handler_audit.go
- handler_authkeys.go
- handler_budgets.go
- handler_guardrails.go
- handler_live.go
- handler_managed_resource.go
- handler_mcpservers.go
- handler_media.go
- handler_model_pricing_overrides.go
- handler_models.go
- handler_plugins.go
- handler_provider_credentials.go
- handler_providers.go
- handler_ratelimits.go
- handler_runtime_settings.go
- handler_tagging.go
- handler_usage.go
- handler_users.go
- handler_virtualmodels.go
- handler_workflows.go
- routes.go
- scope.go