Ollama wire protocol allows keep_alive as either a duration string
("5m", "10s", "-1", "0") or an integer seconds. Real ollama CLI sends
a number; open-webui sends a string. Previous DTO typed keep_alive as
string? which 500'd on numeric input with:
Cannot get the value of a token type 'Number' as a string.
Change OllamaChatRequest, OllamaGenerateRequest, and
OllamaEmbeddingsRequest to accept JsonElement? so either shape
deserializes cleanly. The field is still not used by the server (no
model lifecycle management yet), just consumed and ignored.
Three new tests cover number + string forms on /api/chat and
/api/generate. Serve suite: 45 -> 48 green.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Summary
Ollama wire protocol allows keep_alive as either a duration string ("5m", "10s", "-1", "0") or an integer seconds. Real ollama CLI sends a number; open-webui sends a string. Previous DTO typed keep_alive as string?, which 500'd on numeric input:
Changed OllamaChatRequest, OllamaGenerateRequest, and OllamaEmbeddingsRequest to JsonElement? so either shape deserializes cleanly. Field is still not used by the server (no lifecycle management yet), just consumed and ignored.
Test plan
🤖 Generated with Claude Code