What is going on with the GPT-5 API?

I was able to figure out a way to work with gpt-5-nano. @_j was correct about this:

Increase max_output_tokens to larger than the model would ever produce in reasoning + output, considering your requested reasoning effort and maximum task difficulty.

I was getting empty responses with:

const stream = await openai.chat.completions.create({
    messages: [
      { role: "system", content: "You are an amazing JavaScript developer. When I send a codeblock of JavaScript, you will return a more reusable and better written version of the code." },
      { role: "user", content: "function add(x, y) { var z = x + y; console.log(z); } add(3, 4);" },
    ],
    model: "gpt-5-nano",
    stream: true,
    max_completion_tokens: 1000,
  });

Setting reasoning_effort to minimal helped:

  const stream = await openai.chat.completions.create({
    messages: [
      { role: "system", content: "You are an amazing JavaScript developer. When I send a codeblock of JavaScript, you will return a more reusable and better written version of the code." },
      { role: "user", content: "function add(x, y) { var z = x + y; console.log(z); } add(3, 4);" },
    ],
    model: "gpt-5-nano",
    stream: true,
    max_completion_tokens: 1000,
    reasoning_effort: "minimal"
  });

I was able to find reasoning_effort through:

Constrains effort on reasoning for reasoning models Currently supported values are minimal, low, medium, and high. Reducing reasoning effort can result in faster responses and fewer tokens used on reasoning in a response.
Note: The gpt-5-pro model defaults to (and only supports) high reasoning effort.

https://platform.openai.com/docs/api-reference/chat/create

The minimal setting performs especially well in coding and instruction following scenarios, adhering closely to given directions.

https://platform.openai.com/docs/guides/latest-model#minimal-reasoning-effort

Hope this helps!