erictik / midjourney-api

MidJourney client. Unofficial Node.js client
Apache License 2.0
1.65k stars 271 forks source link

ImagineApi failed with status 400 #205

Open sainikrishan opened 11 months ago

sainikrishan commented 11 months ago

the code that reproduces this issue or a replay of the bug

const { Midjourney } = require("midjourney");

const client = new Midjourney({
  ServerId: process.env.SERVER_ID,
  ChannelId: process.env.CHANNEL_ID,
  SalaiToken: process.env.SALAI_TOKEN,
  Debug: true,
  Ws: true, //enable ws is required for remix mode (and custom zoom)
});

const imagine = async (prompt) => {
  await client.init();

  const Imagine = await client.Imagine(
    prompt,
    (uri, progress) => {
      console.log("loading", uri, "progress", progress);
    }
  );

  if (!Imagine) {
    throw new Error('Unable to imagine.');
  }

  return Imagine;
};

module.exports = {
  imagine
}

Describe the bug

Imagine API is throwing the error: ImagineApi failed with status 400

error log

ImagineApi failed with status 400

gitamineHM commented 11 months ago

It's related to the prompt version ID changing. when they release new version of API see this https://github.com/erictik/midjourney-api/commit/a15e8c70c78d7116af28092c49ad6bec99f000fd#diff-eb2670564ae072c1d316a239d83b7e1ff892808d117e9e232d9d98db4be6fdd4