Documentation
¶
Overview ¶
Package model is a registry of provider-side model capabilities keyed by model id.
Resolve maps a model id to an Info describing which request parameters the provider accepts for it: the backend the id routes to, the effort levels the provider takes natively, whether the sampling parameters (temperature, top_p, top_k) are accepted, whether the Claude extended-thinking budget parameter is accepted, and which generation of Gemini thinking knob applies. Jev ids ("jev-") and Hopper resolve to a backend with no parameter surface at all, since those models take typed questions rather than a conversation.
The registry encodes generation rules plus exception prefixes rather than an exhaustive id list: capabilities derive from the id's backend and version, and small prefix tables list only the models verified to lack a parameter. An id matching no exception prefix therefore resolves to the newest capability surface for its backend — a deliberate bias, so a freshly released model works without a registry change and the exception tables grow only when a model is verified to reject a parameter.
Info.ContextWindow is the exception to that bias. It is the serving context window in tokens, input and output together, and an executor that enforces an input budget trusts it. A wrong window either rejects requests that fit or lets requests through that the provider refuses. It therefore comes from a table of exact base ids (the id before "@"), not prefixes, and lists only windows verified against the provider. Every other id reports 0, which means unknown, and a caller that needs a window must supply it. Add an id to the table only after its window is verified.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend string
Backend identifies the provider surface a model id routes to.
const ( // BackendClaude covers ids with the "claude-" prefix and AWS Bedrock's // corresponding "anthropic.claude-" prefix. BackendClaude Backend = "claude" // BackendGemini covers ids with the "gemini-" prefix, served by the // Google Generative AI API. BackendGemini Backend = "gemini" // BackendOpenAICompat covers "gpt-*" and "publisher/model" ids, served by an // OpenAI-compatible endpoint. BackendOpenAICompat Backend = "openai-compat" // BackendSystemOne covers Jev ids and Hopper: models that answer typed // questions with calibrated probabilities // and take none of the conversational request parameters. BackendSystemOne Backend = "system-one" // BackendUnknown is the zero value, for ids that match no known routing // shape. BackendUnknown Backend = "" )
type Info ¶
type Info struct {
// Backend is the provider surface the model id routes to.
Backend Backend
// Efforts lists the effort levels the provider accepts natively; empty
// means the effort parameter is unsupported.
Efforts []effort.Level
// SamplingParams reports whether temperature/top_p/top_k are accepted.
SamplingParams bool
// ExtendedThinkingBudget reports whether the Claude thinking.budget_tokens
// parameter is accepted.
ExtendedThinkingBudget bool
// AutomaticToolChoiceOnly reports that tool use cannot be forced to a
// specific tool (or to any tool). Callers must prompt with auto selection.
AutomaticToolChoiceOnly bool
// ThinkingControl is the Gemini thinking-knob generation the model takes.
ThinkingControl ThinkingControl
// ContextWindow is the serving context window in tokens, covering input
// and output together. Zero means unknown: callers that enforce an input
// budget must supply the window themselves.
ContextWindow int64
// ExplicitRouteOnly reports that the model must be constructed from a
// route that names its protocol. Only OpenAI Responses preserves these
// models' native effort scale; Chat Completions maps xhigh and max to
// high. A constructor that infers the protocol from the id shape must
// reject them rather than pick one.
ExplicitRouteOnly bool
}
Info describes the provider-side capabilities of a model.
func Resolve ¶
Resolve returns the capability Info for the given model id. The backend is determined from the id's routing shape, matching prefixes case-insensitively; ids that match no known shape resolve to the zero Info (BackendUnknown, no capabilities).
Example ¶
package main
import (
"fmt"
"chainguard.dev/driftlessaf/agents/model"
)
func main() {
info := model.Resolve("claude-fable-5")
fmt.Println(info.Backend)
fmt.Println(info.SamplingParams)
fmt.Println(info.Efforts)
info = model.Resolve("gemini-3-pro-preview")
fmt.Println(info.Backend)
fmt.Println(info.ThinkingControl)
}
Output: claude false [low medium high xhigh max] gemini level
Example (AutomaticToolChoice) ¶
package main
import (
"fmt"
"chainguard.dev/driftlessaf/agents/model"
)
func main() {
fmt.Println(model.Resolve("claude-fable-5-1").AutomaticToolChoiceOnly)
fmt.Println(model.Resolve("claude-sonnet-5").AutomaticToolChoiceOnly)
}
Output: true false
func (Info) SupportsEffort ¶
SupportsEffort reports whether the provider accepts the effort level natively for this model.
Example ¶
package main
import (
"fmt"
"chainguard.dev/driftlessaf/agents/effort"
"chainguard.dev/driftlessaf/agents/model"
)
func main() {
fmt.Println(model.Resolve("claude-opus-4-6").SupportsEffort(effort.XHigh))
fmt.Println(model.Resolve("claude-fable-5").SupportsEffort(effort.XHigh))
}
Output: false true
type ThinkingControl ¶
type ThinkingControl string
ThinkingControl identifies which generation of Gemini thinking knob a model takes.
const ( // ThinkingControlNone marks backends without a Gemini-style knob. ThinkingControlNone ThinkingControl = "" // ThinkingControlBudget marks Gemini models before 3.x, which take a // thinkingBudget token count. ThinkingControlBudget ThinkingControl = "budget" // ThinkingControlLevel marks Gemini 3.x and later, which take a discrete // thinkingLevel enum. ThinkingControlLevel ThinkingControl = "level" )