Can Leiolai return structured JSON that matches a schema?
Yes. Leiolai supports structured JSON output in Chat Completions and Responses. Use the endpoint’s output-format field to request a JSON object or schema-valid JSON. A successful structured response contains the JSON value without extra prose or Markdown fences.
Read the Leiolai API reference
Which field does Chat Completions use?
Set response_format in the Leiolai Chat Completions request. Use json_object for a JSON object, or json_schema with a name and schema plus optional description and strict settings. Put the task in messages and the required JSON structure in response_format.
Chat Completions request fieldsWhich field does Responses use?
Use text.format in a Leiolai Responses request. Choose json_object or json_schema and provide the schema configuration for the output you need. The nesting differs from Leiolai Chat Completions, so move the format field when converting a request.
Responses output formattingWhen should I use a JSON object instead of a schema?
Use Leiolai JSON-object output when your application needs parseable JSON with flexible keys. Use Leiolai schema output when you need defined fields, types, and required values, such as a summary string and an array of action items.
What makes a schema useful for the caller?
Define the fields your application needs from Leiolai. An issue summary might use title, symptoms, and next_checks. Give each property a type, list the required properties, and set additionalProperties: false when extra fields should be excluded.
Will a structured answer include a Markdown code fence?
A successful structured response contains the JSON value without extra prose or Markdown fences. Parse the JSON as data. Check the Leiolai API’s error or terminal status before treating the response as a successful structured result.
Can I request tools and structured output together?
No. Complete the Leiolai tool conversation first, then send a separate request for the structured result. Use response_format in Chat Completions or text.format in Responses for the final JSON.
Use client-defined functionsCan I request a schema through Messages or text Completions?
Those endpoints do not accept a structured-output field. Use Leiolai Chat Completions response_format or Responses text.format when schema-valid JSON is part of your application’s interface. A prose instruction asking for JSON is different from setting a structured-output field.
How should I troubleshoot a rejected schema request?
Check the Leiolai endpoint’s format field, the schema’s JSON syntax, and any conflicting function-tool fields. Reduce the request to a small schema while isolating the error, then add the required output fields.
Interpret invalid request errors