Open source: Python SDK wrapper for structured outputs

Derek Frost
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 BaseModel

class 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
Robert Chang

Enterprise SaaS:

  • GPT-4o: $4,200/month
  • GPT-4o-mini: $890/month
  • Embeddings: $120/month
  • Fine-tuned model: $340/month
  • Total: ~$5,550/month
  • Serving ~15K enterprise users across 3 products.

    Sam Okwu

    Solo founder, consumer app:

  • GPT-4o-mini: $85/month
  • Whisper: $15/month
  • Total: ~$100/month
  • Serving ~200 DAU. The margins work out at our price point.

    Chris Nakamura

    ML team at a mid-size company:

  • GPT-4o: $1,200/month
  • Fine-tuning jobs: $200/month (sporadic)
  • Batch API: $600/month
  • Embeddings: $80/month
  • Total: ~$2,080/month
  • Batch API 50% discount saves us about $600/month.

    Log in to reply to this topic.