OpenAI Introduces Structured Outputs for API: Enhancing Reliability with JSON Schemas

OpenAI launches Structured Outputs for API, ensuring reliable AI responses with JSON Schemas. Boost accuracy, reduce errors, and streamline data processing effortlessly!
Written by
Protecto
Leading Data Privacy Platform for AI Agent Builders
OpenAI Introduces Structured Outputs for API

Table of Contents

Share Article

OpenAI has introduced a new feature called Structured Outputs for API to ensure model-generated responses conform to developer-supplied JSON Schemas. This improvement addresses a long-standing challenge for developers, where large language models (LLMs) often produce unstructured or inconsistent outputs that do not adhere to the desired format. 

What are Structured Outputs? 

Structured Outputs allow developers to ensure that AI model outputs match a specific structure, typically defined by a JSON Schema. This feature builds upon last year’s JSON mode, which improved the generation of valid JSON data but couldn’t guarantee adherence to complex schemas. With Structured Outputs, the models can now reliably produce data in the required format, eliminating the need for manual intervention, retries, or third-party tools. 

One of the core applications of AI is generating structured data from unstructured inputs. For example, developers use OpenAI models to build assistants that fetch data, create reports, or execute complex workflows. Previously, ensuring outputs matched the correct format required tedious efforts, but Structured Outputs automates and guarantees this process. 

How Structured Outputs Work 

Structured Outputs are available in two forms: 

  1. Function Calling: Developers can enforce strict adherence to tools with the strict: true parameter, which is supported by models like gpt-4-0613, gpt-3.5-turbo-0613, and the latest models gpt-4o-2024-08-06 and gpt-4o-mini-2024-07-18. This ensures that any model outputs will conform to the defined tool schema. 
  2. Response Formats: Developers can supply a JSON Schema via the json_schema option for more general responses. Combined with strict: true, this guarantees the model’s response adheres to the format provided. This feature is exclusive to the newer models, GPT-4o versions, making it ideal for advanced workflows. 

Safety and SDK Integration 

OpenAI has incorporated its existing safety protocols into the new Structured Outputs feature. If a request violates safety guidelines, the model can refuse to generate output, and developers will receive a refusal string, enabling easy detection and handling of such cases. Additionally, OpenAI’s Python and Node SDKs now support Structured Outputs, simplifying implementation by allowing schemas to be defined using Pydantic or Zod objects.

Improved Reliability and Performance 

Significant advancements in model training back the introduction of Structured Outputs. The newest model, gpt-4o-2024-08-06, has been trained to understand and produce outputs that match even the most complex schemas, achieving a perfect score in OpenAI’s JSON Schema evaluations. OpenAI uses constrained decoding to further enhance reliability, which restricts the model to only valid tokens based on the schema. This ensures outputs conform to the schema at every step, making the generation process robust and efficient. 

Availability and Cost Savings 

Structured Outputs are now generally available across the API, including the Chat Completions, Assistants, and Batch APIs. It is compatible with vision inputs and works with models supporting function calling. OpenAI has also announced cost savings for developers using the gpt-4o-2024-08-06 model, offering a 50% reduction in input costs and a 33% reduction in output costs compared to previous models. 

This release marks a crucial step toward more reliable and structured AI outputs, streamlining the development of applications that rely on precise data handling. 

Protecto
Leading Data Privacy Platform for AI Agent Builders
Protecto is an AI Data Security & Privacy platform trusted by enterprises across healthcare and BFSI sectors. We help organizations detect, classify, and protect sensitive data in real-time AI workflows while maintaining regulatory compliance with DPDP, GDPR, HIPAA, and other frameworks. Founded in 2021, Protecto is headquartered in the US with operations across the US and India.

Related Articles

Why Preserving Data Structure Matters in De-Identification APIs

Whitespace, hex, and newlines are part of your data contract. Learn how “normalization” breaks parsers and RAG chunking, and why idempotent masking matters....

Regulatory Compliance & Data Tokenization Standards

As we move deeper into 2025, regulatory expectations are rising, AI workloads are expanding rapidly, and organizations are under pressure to demonstrate consistent, trustworthy handling of personal data. Learn how tokenization reduces risk, simplifies compliance, and supports scalable data operations. ...

GDPR Compliance for AI Agents: A Startup’s Guide

Learn how GDPR applies to AI agents, what responsibilities matter most, and the practical steps startups can take to stay compliant with confidence. Think of it as a blueprint for building trustworthy AI without slowing innovation....
Protecto SaaS is LIVE! If you are a startup looking to add privacy to your AI workflows
Learn More