anomalyco / anomalyco/opencode
[OpenCode Go] deepseek-v4-pro via Responses API: 400 tools[N].function missing field 'name' (web_search tool rejected)
@fwang is already working on this.
Since Aug 12, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
deepseek-v4-pro via OpenCode Go (https://opencode.ai/zen/go/v1, Responses API) returns HTTP 400 from Codex:
Error from provider (Console Go): Upstream request failed: [invalid_request_error] Failed to deserialize the JSON body into the target type: tools[8].function: missing field `name`
The same setup works with deepseek-v4-flash, and works with deepseek-v4-pro when using the DeepSeek official API directly.
Environment
- Client: OpenAI Codex CLI 0.147.0 (
wire_api = responses) - Provider base URL:
https://opencode.ai/zen/go/v1 - Model:
deepseek-v4-pro - Reasoning effort: high / max
Root cause (confirmed by capturing the actual request)
I captured the exact request body sent by Codex through a local proxy. tools[8] is:
{"type": "web_search", "external_web_access": {...}}
Per the OpenAI Responses API spec, a web_search tool is a non-function tool and has no name field. The Console Go upstream appears to parse every tool as a function tool and requires function.name, hence:
tools[8].function: missing field `name`
This is the same root cause described in PR #40210 ("toOaCompatibleRequest mapped every tool into {"type":"function","function":{...}}, producing an undefined name that upstream serde rejects ... 400ing the whole request"). It seems that fix is not yet effective on the /v1/responses path for deepseek-v4-pro (tested 2026-08-13, still 400).
Expected behavior
Non-function tools such as web_search should either be accepted as-is (with no function.name requirement) or filtered out when converting to the upstream chat-completions format, while function tools keep their nested function.name (as PR #40210 states).
Repro
- Configure Codex with
model = "deepseek-v4-pro",base_url = "https://opencode.ai/zen/go/v1",wire_api = "responses". - Run any tool-enabled request (e.g.
codex exec "Reply OK"). - Observe the 400 above. Flash model on the same config succeeds.
Related
- #24224, #24344, #27047, #34331
- PR #40210
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.