From e98b5e8b4e1075987679b71c8d205be417c147f9 Mon Sep 17 00:00:00 2001 From: Devon Rifkin Date: Mon, 19 Jan 2026 15:26:17 -0800 Subject: [PATCH] `/api/show`: default to empty model_info (#13785) For `/api/show`, a fully missing `model_info` field trips up various integrators (including a recent Android Studio integration). The primary source of missing info tends to come from models with a remote that are also missing other data. It seems better to me to return an empty `model_info` than making up some other fields within `model_info` (like saying the architecture is `remote` or something like that). So this does slightly change `/api/show`'s behavior that possibly someone is relying on, but it seems more important to ensure the field is always there (from a quick sampling integrations seem to be robust to missing fields _within_ it). Fixes: https://github.com/ollama/ollama/issues/13783 --- api/types.go | 2 +- server/routes.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/types.go b/api/types.go index 09961d994..1a728e09b 100644 --- a/api/types.go +++ b/api/types.go @@ -749,7 +749,7 @@ type ShowResponse struct { Messages []Message `json:"messages,omitempty"` RemoteModel string `json:"remote_model,omitempty"` RemoteHost string `json:"remote_host,omitempty"` - ModelInfo map[string]any `json:"model_info,omitempty"` + ModelInfo map[string]any `json:"model_info"` ProjectorInfo map[string]any `json:"projector_info,omitempty"` Tensors []Tensor `json:"tensors,omitempty"` Capabilities []model.Capability `json:"capabilities,omitempty"` diff --git a/server/routes.go b/server/routes.go index bc848e5a3..f38259b5a 100644 --- a/server/routes.go +++ b/server/routes.go @@ -1149,6 +1149,9 @@ func GetModelInfo(req api.ShowRequest) (*api.ShowResponse, error) { Capabilities: m.Capabilities(), ModifiedAt: manifest.fi.ModTime(), Requires: m.Config.Requires, + // Several integrations crash on a nil/omitempty+empty ModelInfo, so by + // default we return an empty map. + ModelInfo: make(map[string]any), } if m.Config.RemoteHost != "" {