response_format parameter, with type set to json_schema and strict set to true.
This page covers non-streaming requests only. Streaming was not tested.
Authenticate with a Bearer token, the same way you authenticate other NexLLM API calls. See Authentication.
Endpoint
Request
Use the usual Chat Completions fields (model, messages, and optionally max_tokens and temperature), plus:
Set
type to json_schema. Inside json_schema, provide a name, set strict to true, and include your JSON Schema in schema.Code examples
Routes tested on 23 November 2026
These results are from non-streaming production tests on official text routes. They are a snapshot for that date, not a guarantee for every model on a channel. The following routes returned valid JSON that matched a simple weather schema:nexllm/gpt-6-lunaaws-mantle/gpt-6-lunarunware/deepseek-v4-flash-0731novita/qwen3.8-flashaliyun/qwen3.7-flash
runware/claude-haiku-5-5runware/gemini-3.5-flash-lite
Known limits
Results can vary by route. Some official text routes acceptedresponse_format but did not return usable JSON on the cheapest route tested:
aws-runtime/gpt-oss-20breturned reasoning text instead of JSONgeodd/glm-5.3-flashreturned HTTP 200 with empty content
- A Gemini route returned a required field with the wrong constant value and still returned HTTP 200
- On a conflicting or strict schema, a Claude route returned HTTP 200 with empty content and still billed completion tokens
- An invalid or unsatisfiable schema may return a generic server error, such as a message that the channel is unavailable, rather than a clear schema-validation error
- On some routes,
max_tokensmay not cap reasoning tokens. In testing,aliyun/qwen3.7-flashreturned valid JSON but billed a large number of reasoning tokens