Skip to content
DarkSeek API developer preview. View supported features and launch status

JSON output

View Markdown ↗

Request structured output and validate it in your application.

JSON mode#

Use response_format only in an endpoint that supports it. Give the model a clear instruction to return JSON, set a bounded output ceiling and parse the completed response with a strict JSON parser.

curl "$DARKSEEK_BASE_URL/v1/chat/completions" \
  -H "Authorization: Bearer $DARKSEEK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"darkseek-v4.1","messages":[{"role":"user","content":"Return a JSON object with a greeting field."}],"response_format":{"type":"json_object"},"max_tokens":128}'

Schema and truncation#

JSON syntax does not guarantee business-schema validity. Validate types, required fields and allowed values. Incomplete output caused by a token ceiling, network interruption or cancellation is not valid completed structured output.