Commit 057494f93 for llama.cpp
commit 057494f93f859308297cf8d21eee88e3fa17603c
Author: calebrio02 <44554763+calebrio02@users.noreply.github.com>
Date: Wed Sep 23 04:58:09 2026 -0600
server: accept OpenAI video_url content type and data: video URIs (#27921)
The OpenAI chat completions API specifies content part type "video_url"
with a {"url": ...} object, and clients typically send data: URIs
(e.g. data:video/mp4;base64,...). The llama-server only accepted the
non-standard "input_video" type and rejected data: URIs for video
(accept_base64_uri=false), so any OpenAI-conformant client failed with
"unsupported content[].type" or "Invalid uri format".
- accept "video_url" as an alias of "input_video"
- read the media object from whichever key was used
- allow data: URIs for video (data:video/*), as already done for images
diff --git a/tools/server/server-common.cpp b/tools/server/server-common.cpp
index 7bf1138c8..2ff790a5d 100644
--- a/tools/server/server-common.cpp
+++ b/tools/server/server-common.cpp
@@ -1263,12 +1263,13 @@ json oaicompat_chat_params_parse(
p["text"] = get_media_marker();
p.erase("input_audio");
- } else if (type == "input_video") {
+ } else if (type == "input_video" || type == "video_url") {
if (!opt.allow_video) {
throw std::runtime_error("video input is not supported - hint: if this is unexpected, you may need to provide the mmproj");
}
- json input_video = json_value(p, "input_video", json::object());
+ // accept the OpenAI-style "video_url" key as an alias of "input_video"
+ json input_video = json_value(p, type, json::object());
std::string url = json_value(input_video, "data",
json_value(input_video, "url", std::string()));
handle_media(out_files, url, opt.media_path);
@@ -1276,6 +1277,7 @@ json oaicompat_chat_params_parse(
p["type"] = "media_marker";
p["text"] = get_media_marker();
p.erase("input_video");
+ p.erase("video_url");
} else if (type != "text") {
throw std::invalid_argument("unsupported content[].type");