Summary
The Provider API (https://api.commandcode.ai/provider/v1/chat/completions) rejects the standard OpenAI response_format parameter with HTTP 400 — even for {"type": "json_object"}, which the underlying DeepSeek API supports natively. This breaks every OpenAI-compatible client that sends response_format (OpenAI SDK, Vercel AI SDK, Pydantic structured output, agent harnesses), not just the Command Code CLI.
Expected Behavior
response_format: {"type": "json_object"} (DeepSeek JSON mode) should be passed through to the upstream model, since DeepSeek's own Chat Completions API documents and supports json_object. The Provider API claims OpenAI Chat Completions schema compatibility, so OpenAI-standard request parameters should be accepted or at least documented as unsupported — not rejected with a generic 400.
Actual Behavior
HTTP 400 with a double-wrapped error:
{"error":{"message":"{\"error\":{\"message\":\"Invalid input\",\"type\":\"invalid_request_error\",\"param\":\"response_format\",\"code\":\"invalid_request_error\"}}","type":"invalid_request_error"}}
The same request without response_format succeeds (200) and the model returns clean JSON when the prompt asks for it.
Steps to reproduce the issue
curl https://api.commandcode.ai/provider/v1/chat/completions \
-H "Authorization: Bearer $CMD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek/deepseek-v4-pro",
"messages": [{"role": "user", "content": "Return JSON only: {\"answer\": 42}"}],
"response_format": {"type": "json_object"},
"max_completion_tokens": 64
}'
Observed:
- With
response_format → 400 Invalid input, param=response_format
- Without
response_format → 200, content: {"answer": 42} (clean JSON)
- Same request shape against DeepSeek official API with
response_format: {"type":"json_object"} → works (200)
Command Code Version
Provider API (api.commandcode.ai/provider/v1) — not the CLI; no CLI version involved.
Operating System
Linux
Terminal/IDE
n/a (HTTP API test)
Shell
bash
Fix prompt (optional)
In the Provider API gateway, allow response_format: {"type": "json_object"} to pass through to DeepSeek upstream (DeepSeek Chat Completions supports it). If pass-through of json_schema is out of scope for now, at minimum accept json_object and document which response_format variants are supported on the Provider API docs page. A quick check: replay the curl above against the upstream after the fix and expect HTTP 200.
Additional context
- Impact: any agent harness / SDK sending
response_format gets 400 on the Pro route; the workaround (omit the parameter and rely on prompt instructions) is fragile because the model's JSON validity is no longer guaranteed by the API.
- Related behavior: the opencode.ai zen/go route accepts
response_format only when the prompt contains the literal word json — also worth documenting.
- Note: this issue is about the Provider API endpoint (
/provider/v1/chat/completions), not the CLI — there is no separate Provider API bug tracker, so filing here.
Summary
The Provider API (
https://api.commandcode.ai/provider/v1/chat/completions) rejects the standard OpenAIresponse_formatparameter with HTTP 400 — even for{"type": "json_object"}, which the underlying DeepSeek API supports natively. This breaks every OpenAI-compatible client that sendsresponse_format(OpenAI SDK, Vercel AI SDK, Pydantic structured output, agent harnesses), not just the Command Code CLI.Expected Behavior
response_format: {"type": "json_object"}(DeepSeek JSON mode) should be passed through to the upstream model, since DeepSeek's own Chat Completions API documents and supportsjson_object. The Provider API claims OpenAI Chat Completions schema compatibility, so OpenAI-standard request parameters should be accepted or at least documented as unsupported — not rejected with a generic 400.Actual Behavior
HTTP 400 with a double-wrapped error:
{"error":{"message":"{\"error\":{\"message\":\"Invalid input\",\"type\":\"invalid_request_error\",\"param\":\"response_format\",\"code\":\"invalid_request_error\"}}","type":"invalid_request_error"}}The same request without
response_formatsucceeds (200) and the model returns clean JSON when the prompt asks for it.Steps to reproduce the issue
Observed:
response_format→400 Invalid input, param=response_formatresponse_format→200,content: {"answer": 42}(clean JSON)response_format: {"type":"json_object"}→ works (200)Command Code Version
Provider API (
api.commandcode.ai/provider/v1) — not the CLI; no CLI version involved.Operating System
Linux
Terminal/IDE
n/a (HTTP API test)
Shell
bash
Fix prompt (optional)
In the Provider API gateway, allow
response_format: {"type": "json_object"}to pass through to DeepSeek upstream (DeepSeek Chat Completions supports it). If pass-through ofjson_schemais out of scope for now, at minimum acceptjson_objectand document whichresponse_formatvariants are supported on the Provider API docs page. A quick check: replay the curl above against the upstream after the fix and expect HTTP 200.Additional context
response_formatgets 400 on the Pro route; the workaround (omit the parameter and rely on prompt instructions) is fragile because the model's JSON validity is no longer guaranteed by the API.response_formatonly when the prompt contains the literal wordjson— also worth documenting./provider/v1/chat/completions), not the CLI — there is no separate Provider API bug tracker, so filing here.