Open source: Python SDK wrapper for structured outputs
Derek FrostMar 1, 2026
I built openai-structured — a thin Python wrapper that makes working with Structured Outputs feel like working with Pydantic models.
from openai_structured import create_completion
from pydantic import BaseModelclass Person(BaseModel):
name: str
age: int
hobbies: list[str]
person = create_completion(
model="gpt-4o",
messages=[{"role": "user", "content": "Tell me about John"}],
response_model=Person,
)
print(person.name) # "John"
print(person.age) # 30
It handles schema generation, validation, and retries automatically. MIT licensed.
3.4k views18 replies67 likes
3 Replies
Enterprise SaaS:
Serving ~15K enterprise users across 3 products.
ML team at a mid-size company:
Batch API 50% discount saves us about $600/month.
Log in to reply to this topic.