javascriptreactjsaxiosstable-diffusion

Stable Diffusion API with React issue


I'm new here and would appreciate your help. I am currently experiencing an issue with the stablediffusion API. Here's my code.

const request_body = {
    key: process.env.REACT_APP_STABLE_DIFFUSION_API,
    prompt: "ultra realistic close up portrait ((beautiful pale cyberpunk female with heavy black eyeliner))",
    negative_prompt: null,
    width: "512",
    height: "512",
    samples: 1,
    num_inference_steps: "20",
    seed: null,
    guidance_scale: 7.5,
    safety_checker: "yes",
    multi_lingual: "no",
    panorama: "no",
    self_attention: "no",
    upscale: "no",
    embeddings_model: null,
    webhook: null,
    track_id: null,
};

const generateImage = async () => {
  const generateResponse = await axios.post(
    "https://stablediffusionapi.com/api/v5/text2video",
    request_body
  );
  console.log(generateResponse.data);
};

It's not just an issue with the API key. The result is an error. The status shows an error and the error message needs a seconds value.


Solution

  • https://stablediffusionapi.com/api/v3/text2image
    

    Hey @theavocoder, you used the wrong API. The one you used is for text2video. Try using the API above.