SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

OpenAI-compatible providers send response_format json_schema; gateways without it (DeepSeek) fail every analyzer with HTTP 400

Open opentekware opened this issue 2 weeks ago • 1 comments

Summary

With an OpenAI-compatible endpoint that does not implement response_format: {"type": "json_schema"} (DeepSeek in this case), every LLM analyzer request is rejected with HTTP 400, so the LLM stage silently degrades to static-only while the report still says llm_available: true.

Environment

  • skillspector 2.12.0 (installed from git, current main)
  • Python 3.12.3
  • SKILLSPECTOR_PROVIDER=openai_compatible
  • SKILLSPECTOR_COMPAT_BASE_URL=https://api.deepseek.com/v1
  • model deepseek-flash
  • Also reproduced with SKILLSPECTOR_PROVIDER=openai + OPENAI_BASE_URL=https://api.deepseek.com/v1

Symptom

WARNING [skillspector.llm_analyzer_base] LLM_REQUEST_FAILURE {"configured_output_cap": 32000, "error_class": "BadRequestError", "message_class": "request_rejected", "provider_code": "invalid_request_error", "status_code": 400}
WARNING [skillspector.llm_analyzer_base] LLM batch failed for File: SKILL.md (OpenAIInvalidRequestError)
WARNING [skillspector.nodes.report] LLM stage degraded: semantic runtime telemetry was incomplete; report may reflect static analysis only

Report metadata after the run:

{
  "llm_requested": true,
  "llm_available": true,
  "inference_usage": [],
  "analysis_completeness": { "status": "failed", "scanned_components": 0, "coverage_percent": 0 },
  "risk_assessment": { "score": 0, "severity": "LOW", "recommendation": "CAUTION" }
}

Root cause (captured from the wire)

The request body sent by the analyzers contains:

"response_format": {
  "type": "json_schema",
  "json_schema": { "name": "_TP4AnalysisResult", "strict": true, "schema": { } }
}

DeepSeek rejects that: {"error":{"message":"This response_format type is unavailable now","type":"invalid_request_error","code":"invalid_request_error"}}.

Direct probes against the same endpoint:

Request feature Result
response_format: json_schema (strict: true) 400
response_format: json_schema (strict: false) 400
response_format: json_object 200
tools + tool_choice: auto 200
max_completion_tokens: 32000 200
temperature / seed / reasoning_effort 200

So JSON-Schema response format is the only incompatible feature; tool calling works.

Contradiction with the documented behaviour

providers/structured_output.py says:

the openai and openai_compatible providers bind the schema as a tool with tool_choice left at auto and ask for the call in the prompt

Observed wire payload uses response_format: json_schema instead, which is what makes any compat endpoint without JSON-schema support unusable.

Attempted workaround

SKILLSPECTOR_STRUCTURED_OUTPUT_METHOD=function_calling was set for the run; the same 6/6 batch failures (HTTP 400) occurred and inference_usage stayed empty.

Impact

  • Compatible-but-not-identical gateways (DeepSeek, and likely other OpenAI-compatible servers) cannot use the LLM stage at all.
  • The failure is not surfaced as an error: the risk score falls back to 0 / LOW / CAUTION while llm_available reports true. That reads as a clean result for a skill that was never analysed.

Expected

  1. Bind structured output with tool calling for openai_compatible (and for openai when a custom base_url is used), matching the documented behaviour.
  2. Or detect a response_format rejection and retry with tool binding.
  3. Or fail loudly: llm_available: false plus a clear error, rather than an apparent LOW-risk result with llm_available: true and inference_usage: [].

Reproduction

export SKILLSPECTOR_PROVIDER=openai_compatible
export SKILLSPECTOR_COMPAT_BASE_URL=https://api.deepseek.com/v1
export SKILLSPECTOR_COMPAT_API_KEY=...
export SKILLSPECTOR_MODEL=deepseek-flash
skillspector scan ./some-skill --format json --output report.json
# every analyzer batch returns 400; report shows llm_available true, inference_usage []

opentekware avatar Nov 11 '26 20:11 opentekware

Working on a fix for this. The OpenAI-compatible path should fall back to tool calling when a gateway rejects the json_schema response_format, and fail loudly (llm_available: false with a surfaced error) instead of reporting a clean-looking LOW-risk result when structured output is unavailable. Will open a PR against main once the fix and regression tests are ready.

Varshith-Kali avatar Nov 11 '26 22:11 Varshith-Kali