Open AI structured outputs not working

Your docs are outdated and I am unable to generate structured outputs using Gemini open ai compatiblity. There is no property called chat on openai.beta anymore. Please fix this immediately

This is the official documentation, and it does not work.

import OpenAI from "openai";
import { zodResponseFormat } from "openai/helpers/zod";
import { z } from "zod";

const openai = new OpenAI({
   apiKey: "GEMINI_API_KEY",
   baseURL: "https://generativelanguage.googleapis.com/v1beta/openai"
});

const CalendarEvent = z.object({
 name: z.string(),
 date: z.string(),
 participants: z.array(z.string()),
});

const completion = await openai.beta.chat.completions.parse({
 model: "gemini-2.0-flash",
 messages: [
   { role: "system", content: "Extract the event information." },
   { role: "user", content: "John and Susan are going to an AI conference on Friday" },
 ],
 response_format: zodResponseFormat(CalendarEvent, "event"),
});

const event = completion.choices[0].message.parsed;
console.log(event);

Hi @NeilSanghrajka , welcome to the forum.

Thanks for pointing that out, we will update the documentation accordingly.

Appreciate it!