async function openaiMockServer() {
  const server = http.createServer(handler)

  return new Promise((resolve) => {
    server.listen({ host: '127.0.0.1', port: 0 }, () => {
      return resolve({
        server,
        host: server.address().address,
        port: server.address().port
      })
    })
  })
}
Build a mock server that listens on a 127.0.0.1 and a random port that
responds with pre-defined responses based on the "prompt" sent by the
OpenAI client library.

@example
const { server, port } = await openaiMockServer()
const client = new OpenAI({
  baseURL: `http://127.0.0.1:${port}`,
  apiKey: 'some key'
 }

const res = await client.responses.create({
  model: 'gpt-4',
  input: 'You are a scientist.'
})
console.log(response.output_text);

server.close()

@returns {Promise<object>} Has `server`, `host`, and `port` properties.