ModelInfo is what Client.Models returns.
Only three of its fields are populated by every adapter; the rest depend on what
each provider's endpoint discloses.
Reference#
type ModelInfo struct {
ID string
Provider string
DisplayName string
ContextWindow int
MaxOutputTokens int
Raw json.RawMessage
}
Parameters
ID— the identifier to put inRequest.Model.Provider— the adapter that offers it.DisplayName— a human-readable name, when supplied.ContextWindow— maximum input size in tokens.MaxOutputTokens— maximum response size in tokens.Raw— the provider's untouched entry for this model.
Caveats
- Only
ID,ProviderandRaware populated by every adapter. Zero means "not reported", not "zero". - OpenAI supplies almost nothing — its models endpoint has no display name, context window or output cap. The gap is upstream.
- On openaicompat, everything beyond
IDis host-dependent. OpenRouter supplies display name and context window; most others do not. - The list is scoped to your account: models you lack access to do not appear.
What each adapter reports#
| Field | anthropic | openai | openaicompat | gemini |
|---|---|---|---|---|
| ID, Provider, Raw | yes | yes | yes | yes |
| DisplayName | yes | empty | host-dependent | yes |
| ContextWindow | yes | empty | host-dependent | yes |
| MaxOutputTokens | yes | never set | never set | yes |
Usage#
Listing what is available
models, err := client.Models(ctx)
if err != nil {
return err
}
for _, m := range models {
fmt.Printf("%s (%s) context=%d\n", m.ID, m.DisplayName, m.ContextWindow)
}models, err := client.Models(ctx)
if err != nil {
return err
}
for _, m := range models {
fmt.Printf("%s (%s) context=%d\n", m.ID, m.DisplayName, m.ContextWindow)
}Reading metadata skyl does not model
for _, m := range models {
var raw struct {
Pricing struct {
Prompt string `json:"prompt"`
} `json:"pricing"`
}
// OpenRouter publishes pricing; skyl does not model it. Raw has it.
if err := json.Unmarshal(m.Raw, &raw); err == nil && raw.Pricing.Prompt != "" {
fmt.Printf("%s costs %s per prompt token\n", m.ID, raw.Pricing.Prompt)
}
}for _, m := range models {
var raw struct {
Pricing struct {
Prompt string `json:"prompt"`
} `json:"pricing"`
}
// OpenRouter publishes pricing; skyl does not model it. Raw has it.
if err := json.Unmarshal(m.Raw, &raw); err == nil && raw.Pricing.Prompt != "" {
fmt.Printf("%s costs %s per prompt token\n", m.ID, raw.Pricing.Prompt)
}
}Troubleshooting#
ContextWindow is zero on OpenAI
Not reported by their endpoint. Raw holds everything they do send. skyl's plan
for metadata OpenAI does not publish is a generated registry refreshed from
live endpoints by CI, rather than a hand-typed table that rots.
A model is missing from the list on Gemini
Beyond 1000 models the adapter ignores nextPageToken and truncates silently.
In practice Gemini offers far fewer, but query the endpoint directly if you need
completeness.