Negative prompts for the inference api

Hello, for the free inference api, Is there a way to add negative prompts? I heard that huggingface recently added this feature, and was wondering how to include it in my request…

Thanks in advance!

EDIT: this would be for the Stable Diffusion inference api…

Any updates?

hi @jetpackjules,

Yes we’ve recently add the negative prompt to the API

Here is a request example in Javascript

    method: "POST",
    headers: {
      "content-type": "application/json",
    body: JSON.stringify({
        "award winning high resolution photo of a giant tortoise/((ladybird)) hybrid, [trending on artstation]",
      negative_prompt: "blurry",
  .then((res) => res.blob())
  .then((blob) => {
    const tab = = "_blank"));
    tab.location.href = window.URL.createObjectURL(blob);


Awesome, Thankyou very much!

1 Like

Does this also work for Stable Diffusion 1-5, or just 2?

Hi @jetpackjules atm the pipeline is very basic and only supports 512px inference, however we could change that, you can send your opinion needs here Document usage of text-to-image · Issue #152 · huggingface/api-inference-community · GitHub

1 Like

@jetpackjules sorry, it’s automatic, you have to set the sample size on the vae config file


For the negative prompt?