From b20a2f1cea8e40e256aca951cde6ca66f60d4075 Mon Sep 17 00:00:00 2001 From: "LocalAI [bot]" <139863280+localai-bot@users.noreply.github.com> Date: Sat, 11 Apr 2026 22:31:36 +0200 Subject: [PATCH] feat(swagger): update swagger (#9318) Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: mudler <2420543+mudler@users.noreply.github.com> --- swagger/docs.go | 51 ++++++++++++++++++++++++++++++++++++++++++++ swagger/swagger.json | 51 ++++++++++++++++++++++++++++++++++++++++++++ swagger/swagger.yaml | 35 ++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) diff --git a/swagger/docs.go b/swagger/docs.go index e2be7b2b5..e7704d556 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -771,6 +771,57 @@ const docTemplate = `{ } } }, + "/api/models/toggle-pinned/{name}/{action}": { + "put": { + "description": "Pin or unpin a model. Pinned models stay loaded and are excluded from automatic eviction.", + "tags": [ + "config" + ], + "summary": "Toggle model pinned status", + "parameters": [ + { + "type": "string", + "description": "Model name", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Action: 'pin' or 'unpin'", + "name": "action", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + } + } + } + }, "/api/models/vram-estimate": { "post": { "description": "Estimates VRAM based on model weight files, context size, and GPU layers", diff --git a/swagger/swagger.json b/swagger/swagger.json index 944877462..56ef9752e 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -768,6 +768,57 @@ } } }, + "/api/models/toggle-pinned/{name}/{action}": { + "put": { + "description": "Pin or unpin a model. Pinned models stay loaded and are excluded from automatic eviction.", + "tags": [ + "config" + ], + "summary": "Toggle model pinned status", + "parameters": [ + { + "type": "string", + "description": "Model name", + "name": "name", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "Action: 'pin' or 'unpin'", + "name": "action", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "404": { + "description": "Not Found", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/localai.ModelResponse" + } + } + } + } + }, "/api/models/vram-estimate": { "post": { "description": "Estimates VRAM based on model weight files, context size, and GPU layers", diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 184d203fa..874a7fef4 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -2241,6 +2241,41 @@ paths: summary: Get dynamic autocomplete values for a config field tags: - config + /api/models/toggle-pinned/{name}/{action}: + put: + description: Pin or unpin a model. Pinned models stay loaded and are excluded + from automatic eviction. + parameters: + - description: Model name + in: path + name: name + required: true + type: string + - description: 'Action: ''pin'' or ''unpin''' + in: path + name: action + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/localai.ModelResponse' + "400": + description: Bad Request + schema: + $ref: '#/definitions/localai.ModelResponse' + "404": + description: Not Found + schema: + $ref: '#/definitions/localai.ModelResponse' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/localai.ModelResponse' + summary: Toggle model pinned status + tags: + - config /api/models/vram-estimate: post: consumes: