mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-16 07:33:06 +08:00
Legacy Chat function calling has no call IDs: the assistant turn carries function_call and the role=function result refers to it only by name. ChatCompletionsToResponses ignored the assistant function_call and used the function name as the result's call_id, so the Responses upstream got a function_call_output with no matching function_call and rejected the replayed history. Emit a function_call item for each legacy assistant call and give the following same-name result the same call_id. IDs follow message order (call_legacy_N), so the same history converts to the same input across turns, and skip IDs already used by tool_calls. A result with no preceding call keeps the previous name-based call_id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>