Documentation
¶
Overview ¶
Package router resolves the model name in a request to the adapter that serves it.
Names are namespaced "<adapter>" or "<adapter>:<model>". A bare adapter id means the CLI's own default model; anything after the colon goes to the CLI verbatim, since it is the authority on what it accepts and agent2api keeps no list to go stale. A name naming no served adapter is a 404.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Resolution ¶
type Resolution struct {
// Model is the canonical name the backend was reached by, e.g.
// "claude-code:opus" or bare "claude-code".
Model string
// Variant is the model name to hand the CLI, empty for its own default.
Variant string
Adapter adapter.Adapter
}
Resolution is a routed model.
func (Resolution) EnforcesSchema ¶ added in v0.1.3
func (r Resolution) EnforcesSchema(ctx context.Context) bool
EnforcesSchema reports whether the resolved backend can hold an answer to a JSON Schema. Frontends ask before accepting a caller's schema, so a refusal can name the backend that cannot do it rather than reading as a gateway-wide limitation.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router maps model names to adapters. It is immutable after construction and safe for concurrent use.
func (*Router) Entries ¶
Entries lists what GET /v1/models advertises: one row per backend, named by its adapter id. Callers may append ":<model>" to any of them.