You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Codex correctly captures reasoning content internally (ReasoningItem::raw_content in codex-rs/protocol/src/items.rs:120), but when building the messages array for the next API request, the reasoning_content field is not included in the serialized assistant message.
Steps to Reproduce
Configure Codex to use a DeepSeek model with thinking mode
Send a multi-turn conversation (any task requiring multiple API calls/tool calls)
After the first turn produces reasoning content, the second API request fails with the above error
Expected Behavior
When using DeepSeek thinking mode, each assistant message in the API request should include:
The conversion from ResponseItem::Reasoning → TurnItem::Reasoning in codex-rs/core/src/event_mapping.rs:156-182 preserves raw_content, but the downstream serialization to API-compatible messages does not map it to the reasoning_content field required by DeepSeek.
Related Issues
This is a known pattern affecting multiple projects using DeepSeek API:
When building the messages array for provider API calls, for DeepSeek models specifically, include reasoning_content from ReasoningItem::raw_content in every assistant message. For other providers (OpenAI), omit it as before (OpenAI ignores unknown fields but DeepSeek requires this field).
I took a quick look at current main. This may not be a small field-mapping fix in Codex itself because custom providers now appear to be Responses-only: wire_api = "chat" is rejected, and streaming goes through /v1/responses.
Codex does preserve reasoning as ResponseItem::Reasoning.content, but DeepSeek’s documented requirement is specifically for Chat Completions history messages to replay assistant.reasoning_content after tool-call turns. If this is happening through a local Responses→Chat proxy, the missing replay may belong in that proxy/adapter rather than Codex’s native Responses request path.
Could you share the exact provider config and whether a proxy/adapter is being used?
92645417d9e5c763259dbebc306e3e commented on May 26, 2026
You can avoid the failing Chat reasoning_content history path by keeping Codex on its Responses client surface and routing that through DeepSeek's native Anthropic-compatible Messages endpoint using local compatibility gateway.
Install Swobu:
curl -fsSL https://swobu.com/install.sh | sh -s
In TUI, create a workspace named deepseek (or dev/work/<project name>), add a route, then add a target with:
provider DeepSeek
credential env:DEEPSEEK_API_KEY
model deepseek-v4-pro
Point Codex at the workspace:
model = "default"model_provider = "swobu"
[model_providers.swobu]
name = "Swobu"base_url = "http://127.0.0.1:7926/c/deepseek"env_key = "OPENAI_API_KEY"wire_api = "responses"
OPENAI_API_KEY can be any non-empty placeholder for the loopback Codex provider; keep the real DeepSeek key in DEEPSEEK_API_KEY for Swobu.
I tested the released binary with the actual Codex CLI: Codex made a shell tool call, returned the tool result, and completed through deepseek-v4-pro with thinking enabled.
This is an alternate provider path, not a Codex fix. It avoids Responses→Chat conversion entirely, so there is no Chat assistant reasoning_content field for Codex or a proxy to reconstruct.
Disclosure: I maintain Swobu. If you try this with the original task, please share whether the multi-turn tool loop completes.
Activity
Statusnone420 commentedon May 25, 2026
I took a quick look at current
main. This may not be a small field-mapping fix in Codex itself because custom providers now appear to be Responses-only:wire_api = "chat"is rejected, and streaming goes through/v1/responses.Codex does preserve reasoning as
ResponseItem::Reasoning.content, but DeepSeek’s documented requirement is specifically for Chat Completions history messages to replayassistant.reasoning_contentafter tool-call turns. If this is happening through a local Responses→Chat proxy, the missing replay may belong in that proxy/adapter rather than Codex’s native Responses request path.Could you share the exact provider config and whether a proxy/adapter is being used?
92645417d9e5c763259dbebc306e3e commentedon May 26, 2026
https://github.com/meomeo-dev/deepseekx
metrofun commentedon Aug 3, 2026
You can avoid the failing Chat
reasoning_contenthistory path by keeping Codex on its Responses client surface and routing that through DeepSeek's native Anthropic-compatible Messages endpoint using local compatibility gateway.Install Swobu:
curl -fsSL https://swobu.com/install.sh | sh -sIn TUI, create a workspace named
deepseek(ordev/work/<project name>), add a route, then add a target with:Point Codex at the workspace:
OPENAI_API_KEYcan be any non-empty placeholder for the loopback Codex provider; keep the real DeepSeek key inDEEPSEEK_API_KEYfor Swobu.I tested the released binary with the actual Codex CLI: Codex made a shell tool call, returned the tool result, and completed through
deepseek-v4-prowith thinking enabled.This is an alternate provider path, not a Codex fix. It avoids Responses→Chat conversion entirely, so there is no Chat assistant
reasoning_contentfield for Codex or a proxy to reconstruct.Disclosure: I maintain Swobu. If you try this with the original task, please share whether the multi-turn tool loop completes.