Use Cases
Structured Outputs enables models to generate responses that conform to the JSON Schema you provide, making generated results more controllable and easier to parse. This feature facilitates parsing and processing in downstream logic, and also helps integrate results into business systems. It is suitable for a variety of automation and data processing scenarios.
Supported Models
The following models support structured outputs:
Usage
Add the following information to your request:
- Set parameters: Specify your defined JSON Schema through the
response_format parameter.
- Prompt guidance: Instruct the model in your prompt to produce structured output.
Example
The following provides a complete Python code example demonstrating how to use Structured Outputs to generate a JSON response that conforms to the JSON Schema you provide.
1. Initialize the Client
You need to initialize the client with your JieKou AI API key.
2. Define the JSON Schema
You need to define a JSON Schema. The following example creates a JSON Schema that extracts expense information from user input.
3. Make an API Request
Create an API request. This request includes the response_format parameter, which specifies the JSON schema defined in the previous step.
Output:
Complete Code
Last modified on June 10, 2026