fix(ai): record provider-returned model in managed openai completions stream (#128324)

Co-authored-by: Aniruddha Adak <aniruddhaadak80@users.noreply.github.com>
This commit is contained in:
ANIRUDDHA ADAK
2026-08-26 09:55:07 +05:30
committed by GitHub
parent 215de48bd5
commit edd9eb650c
2 changed files with 7 additions and 0 deletions
@@ -421,6 +421,12 @@ export async function processCompletionsStream(
notifyLlmRequestActivity(options?.signal);
const chunk = rawChunk as OpenAICompatibleChatCompletionChunk;
output.responseId ||= chunk.id;
// Retain the provider-returned model when it differs from the requested id so
// routed/alias responses are not misattributed, matching the direct provider
// stream and the anthropic/responses managed transports.
if (typeof chunk.model === "string" && chunk.model.length > 0 && chunk.model !== model.id) {
output.responseModel ||= chunk.model;
}
let hasReasoningUsageActivity = false;
if (chunk.usage) {
output.usage = parseOpenAICompletionsUsage(chunk.usage, model);
@@ -207,6 +207,7 @@
"provider": "openai",
"model": "gpt-5.5",
"responseId": "chatcmpl-parity",
"responseModel": "gpt-5.5-response",
"openclawDelivery": {
"textPhaseRequiresTerminal": true
},