I’ve been trying to use Zod for schema validation with the OpenAI responses.create method, and I’m facing some challenges. Whenever I use the zodResponseFormat helper function, which previously worked with the chat completions interface, I encounter a TypeScript error that reads “No overload matches this call.”
Is there an alternative way to validate structured outputs with Zod using the responses.create method? The older completion interface was easier for this kind of schema integration.
I hit the same issue migrating from the old completion methods. The responses.create method has different type definitions that don’t play nice with zodResponseFormat. Here’s what worked for me: handle validation separately after getting the response. Use the standard response_format parameter with type “json_object”, then parse and validate with userSchema.parse(). You get the same validation benefits without the TypeScript headaches. Output quality stays the same - you’re just moving validation to post-processing instead of the API call.
downgrading to OpenAI SDK v4.28.x resolved my zodResponseFormat issue too. newer versions mess up types with Zod, so it’s worth rolling back. alternatively, you could validate after defining response format, but it’s way messier.
Skip the TypeScript headaches and SDK version hell - just automate this with Latenode. Set up a flow where one node hits the OpenAI API with standard JSON, then pipe that to a validation node running your Zod schema. No more compatibility issues.
I’ve done this for data pipelines at work. You get error handling, retries, and can route bad responses wherever you need. Plus built-in logging and monitoring.
Best part? You can swap OpenAI methods or try different AI providers without touching your validation code. Everything stays modular.
Takes 10 minutes to set up and you’re done worrying about SDK updates breaking things. Way better than fighting TypeScript definitions.
Yeah, responses.create doesn’t play nice with zodResponseFormat because of stricter typing. I’ve been using a custom wrapper function to get around this - just define your schema validation separately, then use regular structured outputs and parse manually. Quick fix is casting the zodResponseFormat result like response_format: zodResponseFormat(userSchema, "userData") as any. Not pretty but it works until they fix the SDK. Honestly, I’d just stick with chat.completions.create for Zod stuff since it handles structured outputs way better. responses.create still feels like it’s in beta.