TypeError: Cannot read properties of undefined (reading 'choices')

Im trying to work with the api and discord.js, i’m actually using a function that fechs the last 10 messages and gives it to the API, but I’m having and unexpected TypeError: Cannot read properties of undefined (reading ‘choices’)
This is the code:


And the console outputs:

API Response:  {
  id: 'chatcmpl-9Qewb30vZ2TGHy8CihWro7zHaXOlh',
  object: 'chat.completion',
  created: 1716140945,
  model: 'gpt-3.5-turbo-0125',
  choices: [
    {
      index: 0,
      message: [Object],
      logprobs: null,
      finish_reason: 'stop'
    }
  ],
  usage: { prompt_tokens: 104, completion_tokens: 9, total_tokens: 113 },
  system_fingerprint: null
}
API Response:  undefined