Documentation
¶
Overview ¶
Package gateway is the LLM-side passthrough provider. It wraps a set of model-prefix → underlying provider routes and delegates each ChatRequest to the route that matches the request's Model.
The "gateway" name parallels the MCP gateway: just as Gateway.CallTool fronts heterogeneous downstream MCP servers behind one entry point, llm.gateway.Provider fronts heterogeneous LLM vendors behind one agent.ChatModel. The runtime holds a single provider; provider selection is a configuration concern, not an architectural one.
Routes are matched by Model prefix in the order they were registered; the first match wins. Providers are intentionally registered with short prefixes ("claude-", "gpt-", "gemini-") so a single instance can serve mixed-provider skills out of the box.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Provider during construction.
func WithFallback ¶
WithFallback sets a provider used when no prefix matches. Without a fallback, unmatched requests return an error.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider implements agent.ChatModel by routing to one of N underlying providers based on ChatRequest.Model. Construct via New.
func New ¶
New constructs a routing Provider. At least one route or a fallback must be configured; an empty router returns an error so misconfigured callers fail at construction rather than on first request.
func (*Provider) Generate ¶
func (p *Provider) Generate(ctx context.Context, req agent.ChatRequest) (agent.ChatResponse, error)
Generate dispatches the request to the matching underlying provider.