Documentation
¶
Overview ¶
Package tokenhub contains the provider-neutral configuration contract for TokenHub-compatible gateways. Transport and request conversion stay in the existing OpenAI/Anthropic adaptors until a channel is explicitly selected; this package deliberately does not read local credentials or log secrets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeBaseURL ¶
NormalizeBaseURL validates and canonicalizes a configured gateway endpoint. Only HTTP(S) URLs with a host are accepted; credentials and query strings are rejected so an accidental secret cannot be embedded in the endpoint.
Types ¶
type Client ¶
type Client struct {
Config Config
// contains filtered or unexported fields
}
Client provides bounded, secret-safe probes for an explicitly configured TokenHub endpoint. Routing and billing stay in MyAPI's existing services.
type Config ¶
type Config struct {
BaseURL string
Region string
Protocol Protocol
ModelListPath string
HealthPath string
AllowModelDiscovery bool
ModelAliases map[string]string
}
Config is the stable boundary between MyAPI routing policy and a TokenHub upstream. APIKey is held by the caller and is never included in errors or String methods.
func FromSettings ¶
func FromSettings(settings *dto.TokenHubSettings) (Config, error)
FromSettings converts persisted channel settings into a validated runtime config. It does not inspect or copy the channel credential.
func (Config) ResolveModel ¶
ResolveModel applies an optional administrative alias without changing the caller's model string when no alias is configured.