Documentation
¶
Overview ¶
Package amp implements the Amp CLI routing module, providing OAuth-based integration with Amp CLI for ChatGPT and Anthropic subscriptions.
Package amp provides model mapping functionality for routing Amp CLI requests to alternative models when the requested model is not available locally.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module implements the RouteModuleV2 interface for Amp CLI integration. It provides:
- Reverse proxy to Amp control plane for OAuth/management
- Provider-specific route aliases (/api/provider/{provider}/...)
- Automatic gzip decompression for misconfigured upstreams
- Model mapping for routing unavailable models to alternatives
func New ¶
New creates a new Amp routing module with the given options. This is the preferred constructor using the Option pattern.
Example:
ampModule := amp.New(
amp.WithAccessManager(accessManager),
amp.WithAuthMiddleware(authMiddleware),
)
func (*Module) GetModelMapper ¶
func (m *Module) GetModelMapper() *defaultModelMapper
GetModelMapper returns the model mapper instance (for testing/debugging). noinspection GoExportedFuncWithUnexportedType — internal package, unexported return type is intentional.
func (*Module) OnConfigUpdated ¶
OnConfigUpdated handles configuration updates with partial reload support. Only updates components that have actually changed to avoid unnecessary work. Supports hot-reload for: model-mappings, upstream-api-key, upstream-url, restrict-management-to-localhost.
type Option ¶
type Option func(*Module)
Option configures the Module.
func WithAccessManager ¶
WithAccessManager sets the access manager for the module.
func WithAuthMiddleware ¶
func WithAuthMiddleware(middleware gin.HandlerFunc) Option
WithAuthMiddleware sets the authentication middleware for provider routes.