How can I hire a ready-made assistant? I am programming in node.js

I already have the assistant created, but in my own interface, I have already made a code but it gives me a 404 error. I followed the steps that the documentation gives us but it creates a new one every time I run the code.

What I want to achieve is to occupy one that I have already made.

code

// import the required dependencies
require(“dotenv”).config();
const { OpenAI, ToolType } = require(“openai”);
const readline = require(“readline”).createInterface({
input: process.stdin,
output: process.stdout,
});

// Create a OpenAI connection
const secretKey = process.env.OPENAI_API_KEY;
const openai = new OpenAI({
apiKey: secretKey,
});

// ID del asistente existente
const existingAssistantId = ‘asst_FIRh4F0IEZnsTyhNPw4RjSAB’;

async function askQuestion(question) {
return new Promise((resolve, reject) => {
readline.question(question, (answer) => {
resolve(answer);
});
});
}

async function main() {
try {
// Log the first greeting
console.log(
“\nHola, soy especialista en el area de pintura, igualacion leo tu pregunta.\n”
);

// Create a thread associated with the existing assistant
const thread = await openai.beta.threads.create({
  assistant_id: existingAssistantId
});

// Use keepAsking as state for keep asking questions
let keepAsking = true;
while (keepAsking) {
  const userQuestion = await askQuestion("\n¿Cuál es tu pregunta? ");

  // Pass in the user question into the existing thread
  await openai.beta.threads.messages.create(thread.id, {
    role: "user",
    content: userQuestion,
  });

  // Use runs to wait for the assistant response and then retrieve it
  const run = await openai.beta.threads.runs.create(thread.id, {
    assistant_id: existingAssistantId,
  });
  

  let runStatus = await openai.beta.threads.runs.retrieve(
    thread.id,
    run.id
  );

  // Polling mechanism to see if runStatus is completed
  while (runStatus.status !== "completed") {
    await new Promise((resolve) => setTimeout(resolve, 2000));
    runStatus = await openai.beta.threads.runs.retrieve(thread.id, run.id);
  }

  // Get the last assistant message from the messages array
  const messages = await openai.beta.threads.messages.list(thread.id);

  // Find the last message for the current run
  const lastMessageForRun = messages.data
    .filter(
      (message) => message.run_id === run.id && message.role === "assistant"
    )
    .pop();

  // If an assistant message is found, console.log() it
  if (lastMessageForRun) {
    console.log(`${lastMessageForRun.content[0].text.value} \n`);
  }

  // Then ask if the user wants to ask another question and update keepAsking state
  const continueAsking = await askQuestion(
    "¿quieres hacer mas preguntas? (si/no) "
  );
  keepAsking = continueAsking.toLowerCase() === "si";

  // If the keepAsking state is falsy show an ending message
  if (!keepAsking) {
    console.log("Espero haber respondido tus preguntas!\n");
  }
}

// close the readline
readline.close();

} catch (error) {
console.error(error);
}
}

// Call the main function
main();