Connect openai api to my new gpt

hello, i created a GPT using the builder, is an assistance for one of my projects, the problem is, how can i connect to that specific gpt using the API, currently im connected in this way to the API:

async function getAnswer(message) {
  try {
    const chatCompletion = await openai.chat.completions.create({
      messages: [
        { role: 'system', content: 'conversation with user' },
        info,
        { role: 'user', content: message },
      ],
      model: 'gpt-3.5-turbo',
    });

    return chatCompletion.choices[0].message.content
  } catch (err) {
    console.log(err);
    return 'Te quedaste sin tokens en openAI.'
  }
}

how can I specifiy that i want to use my GPT and not the global gpt-3.5-turbo model.

With Assistants, you have to also create threads, messages and runs. You should check out the API documentation at this link: https://platform.openai.com/docs/api-reference/assistants

Custom GPTs are front end, you don’t connect to them as if they are a backend API. Use the Assistants API instead.

2 Likes