From 57fa178a64151239b7f05c5f48e9c00588fbe1fc Mon Sep 17 00:00:00 2001 From: "LocalAI [bot]" <139863280+localai-bot@users.noreply.github.com> Date: Fri, 15 May 2026 09:30:29 +0200 Subject: [PATCH] feat(swagger): update swagger (#9824) 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 | 23 ++++++++++++++++++++++- swagger/swagger.json | 23 ++++++++++++++++++++++- swagger/swagger.yaml | 19 ++++++++++++++++++- 3 files changed, 62 insertions(+), 3 deletions(-) diff --git a/swagger/docs.go b/swagger/docs.go index 0b1b0514d..9f5a33c71 100644 --- a/swagger/docs.go +++ b/swagger/docs.go @@ -5347,6 +5347,14 @@ const docTemplate = `{ "stream": { "type": "boolean" }, + "stream_options": { + "description": "StreamOptions opts into OpenAI streaming extensions, e.g. include_usage.", + "allOf": [ + { + "$ref": "#/definitions/schema.StreamOptions" + } + ] + }, "temperature": { "type": "number" }, @@ -5412,7 +5420,12 @@ const docTemplate = `{ "type": "string" }, "usage": { - "$ref": "#/definitions/schema.OpenAIUsage" + "description": "Usage is intentionally a pointer with omitempty: per the OpenAI\nchat-completion streaming spec, intermediate chunks must not carry\na ` + "`" + `usage` + "`" + ` field. Marshalling a value-typed usage would emit\n` + "`" + `\"usage\":{\"prompt_tokens\":0,...}` + "`" + ` on every chunk and break\nOpenAI-SDK consumers that filter on a truthy ` + "`" + `result.usage` + "`" + `\n(continuedev/continue, Kilo Code, Roo Code, etc.).", + "allOf": [ + { + "$ref": "#/definitions/schema.OpenAIUsage" + } + ] } } }, @@ -5578,6 +5591,14 @@ const docTemplate = `{ } } }, + "schema.StreamOptions": { + "type": "object", + "properties": { + "include_usage": { + "type": "boolean" + } + } + }, "schema.SysInfoModel": { "type": "object", "properties": { diff --git a/swagger/swagger.json b/swagger/swagger.json index 65047fe86..50ad9b3e1 100644 --- a/swagger/swagger.json +++ b/swagger/swagger.json @@ -5344,6 +5344,14 @@ "stream": { "type": "boolean" }, + "stream_options": { + "description": "StreamOptions opts into OpenAI streaming extensions, e.g. include_usage.", + "allOf": [ + { + "$ref": "#/definitions/schema.StreamOptions" + } + ] + }, "temperature": { "type": "number" }, @@ -5409,7 +5417,12 @@ "type": "string" }, "usage": { - "$ref": "#/definitions/schema.OpenAIUsage" + "description": "Usage is intentionally a pointer with omitempty: per the OpenAI\nchat-completion streaming spec, intermediate chunks must not carry\na `usage` field. Marshalling a value-typed usage would emit\n`\"usage\":{\"prompt_tokens\":0,...}` on every chunk and break\nOpenAI-SDK consumers that filter on a truthy `result.usage`\n(continuedev/continue, Kilo Code, Roo Code, etc.).", + "allOf": [ + { + "$ref": "#/definitions/schema.OpenAIUsage" + } + ] } } }, @@ -5575,6 +5588,14 @@ } } }, + "schema.StreamOptions": { + "type": "object", + "properties": { + "include_usage": { + "type": "boolean" + } + } + }, "schema.SysInfoModel": { "type": "object", "properties": { diff --git a/swagger/swagger.yaml b/swagger/swagger.yaml index 216359240..67b747e12 100644 --- a/swagger/swagger.yaml +++ b/swagger/swagger.yaml @@ -1650,6 +1650,10 @@ definitions: stop: {} stream: type: boolean + stream_options: + allOf: + - $ref: '#/definitions/schema.StreamOptions' + description: StreamOptions opts into OpenAI streaming extensions, e.g. include_usage. temperature: type: number tfz: @@ -1698,7 +1702,15 @@ definitions: object: type: string usage: - $ref: '#/definitions/schema.OpenAIUsage' + allOf: + - $ref: '#/definitions/schema.OpenAIUsage' + description: |- + Usage is intentionally a pointer with omitempty: per the OpenAI + chat-completion streaming spec, intermediate chunks must not carry + a `usage` field. Marshalling a value-typed usage would emit + `"usage":{"prompt_tokens":0,...}` on every chunk and break + OpenAI-SDK consumers that filter on a truthy `result.usage` + (continuedev/continue, Kilo Code, Roo Code, etc.). type: object schema.OpenAIUsage: properties: @@ -1813,6 +1825,11 @@ definitions: $ref: '#/definitions/schema.NodeData' type: array type: object + schema.StreamOptions: + properties: + include_usage: + type: boolean + type: object schema.SysInfoModel: properties: id: