// (i) Does Chat Completions still work? Streaming chunk + usage shape; temperature behaviour on GPT-5.x via chat. import { client, attempt, save } from "./lib"; const out: any[] = []; out.push(await attempt("chat:gpt-4.1-mini:stream+temperature", async () => { const s = await client.chat.completions.create({ model: "gpt-4.1-mini", messages: [{ role: "system", content: "Be terse." }, { role: "user", content: "Say pong." }], temperature: 0.3, max_completion_tokens: 30, stream: true, stream_options: { include_usage: true } }); let text = "", usage: any = null, finish: any = null, n = 0, first: any = null; for await (const c of s) { n++; if (!first) first = c; text += c.choices[0]?.delta?.content ?? ""; if (c.choices[0]?.finish_reason) finish = c.choices[0].finish_reason; if (c.usage) usage = c.usage; } return { chunks: n, first_chunk: first, text, finish, usage }; })); out.push(await attempt("chat:gpt-5.5:temperature", () => client.chat.completions.create({ model: "gpt-5.5", messages: [{ role: "user", content: "Say pong." }], temperature: 0.3, max_completion_tokens: 30 }).then(r => ({ text: r.choices[0].message.content, usage: r.usage })))); out.push(await attempt("chat:gpt-5.5:reasoning_effort=low+verbosity", () => client.chat.completions.create({ model: "gpt-5.5", messages: [{ role: "developer", content: "Be terse." }, { role: "user", content: "Say pong." }], reasoning_effort: "low", verbosity: "low", max_completion_tokens: 60 } as any).then(r => ({ text: r.choices[0].message.content, usage: r.usage, model: r.model })))); out.push(await attempt("chat:gpt-6-astra:max_tokens(deprecated param)", () => client.chat.completions.create({ model: "gpt-6-astra", messages: [{ role: "user", content: "Say pong." }], max_tokens: 60 } as any).then(r => ({ text: r.choices[0].message.content, usage: r.usage })))); out.push(await attempt("chat:o4-mini:stream", async () => { const s = await client.chat.completions.create({ model: "o4-mini", messages: [{ role: "user", content: "Say pong." }], max_completion_tokens: 60, stream: true, stream_options: { include_usage: true } }); let usage: any = null, text = ""; for await (const c of s) { text += c.choices[0]?.delta?.content ?? ""; if (c.usage) usage = c.usage; } return { text, usage }; })); save("10-chat-completions", out);