serve: /v1/models/:id answers the model object, not a list of one

OpenAI's retrieve returns the entry itself, and its SDK reads `id` off the top level, where
the list of one this route answered before has none. /v1/models still answers the list.
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-08 15:57:51 +02:00
1 parent 86128c2e75
commit 3a3345951f
6 files changed
+65 -22

No files matched your search

+5 -1
View File
@@ -1153,8 +1153,12 @@ HttpResponse Server::handle_models(const HttpRequest& req) {
e.message = "no such model: " + id;
return error_response(e, req.peer);
}
ModelCard c;
c.id = opt_.model_id;
c.created = started_at_;
c.max_model_len = opt_.max_ctx;
metrics_.observe_http(200);
return HttpResponse::json_body(200, models_body(opt_.model_id, started_at_, opt_.max_ctx));
return HttpResponse::json_body(200, id.empty() ? models_body(c) : model_body(c));
}
HttpResponse Server::handle_metrics(const HttpRequest&) {