# Negative prompts for the inference api

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%3E%5C
**Category:** 🤗Hub\
**Created:** [February 18, 2023, 12:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943 "2023-02-18T00:40:39Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![jetpackjules](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jetpackjules/32/14161_2.png) [@jetpackjules](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjetpackjules)%5C
**Post date:** [February 18, 2023, 12:40am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F1 "2023-02-18T00:40:39Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![jetpackjules](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jetpackjules/32/14161_2.png) [@jetpackjules](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjetpackjules)%5C
**Post date:** [February 27, 2023, 7:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F2 "2023-02-27T19:10:19Z")

</div>

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

Any updates?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [February 27, 2023, 9:10pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F3 "2023-02-27T21:10:20Z")

</div>

hi @jetpackjules,

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

Here is a request example in Javascript

```js
fetch(
  "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2Fstabilityai%2Fstable-diffusion-2",
  {
    method: "POST",
    headers: {
      "content-type": "application/json",
    },
    body: JSON.stringify({
      inputs:
        "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 = window.open((target = "_blank"));
    tab.location.href = window.URL.createObjectURL(blob);
  });

```

> <https://github.com/huggingface/api-inference-community/blob/6f39af264188099a8929cd2a0148b85c7690b0c4/docker_images/diffusers/app/pipelines/text_to_image.py#L57>

Blockquote

---

<div class="post-metadata">

**Author:** ![jetpackjules](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jetpackjules/32/14161_2.png) [@jetpackjules](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjetpackjules)%5C
**Post date:** [February 27, 2023, 9:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F4 "2023-02-27T21:53:02Z")

</div>

Awesome, Thankyou very much!

---

<div class="post-metadata">

**Author:** ![jetpackjules](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jetpackjules/32/14161_2.png) [@jetpackjules](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjetpackjules)%5C
**Post date:** [February 27, 2023, 10:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F5 "2023-02-27T22:19:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [February 27, 2023, 10:37pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F6 "2023-02-27T22:37:57Z")

</div>

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](https://github.com/huggingface/api-inference-community/issues/152)

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fradames)%5C
**Post date:** [February 27, 2023, 10:45pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F7 "2023-02-27T22:45:11Z")

</div>

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

Compare

> **[vae/config.json · stabilityai/stable-diffusion-2 at main](https://huggingface.co/stabilityai/stable-diffusion-2/blob/main/vae/config.json#L23)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

> **[vae/config.json · TheLastBen/froggy-style at main](https://huggingface.co/TheLastBen/froggy-style/blob/main/vae/config.json#L23)**
>
> We’re on a journey to advance and democratize artificial intelligence through open source and open science.

---

<div class="post-metadata">

**Author:** ![jetpackjules](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jetpackjules/32/14161_2.png) [@jetpackjules](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjetpackjules)%5C
**Post date:** [February 27, 2023, 11:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F8 "2023-02-27T23:06:45Z")

</div>

For the negative prompt?

---

<div class="post-metadata">

**Author:** ![sjsjd](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sjsjd](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsjsjd)%5C
**Post date:** [August 22, 2023, 7:17am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F9 "2023-08-22T07:17:09Z")

</div>

Hey, how to download an image from this data and display it in nodejs?

---

<div class="post-metadata">

**Author:** ![sjsjd](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@sjsjd](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsjsjd)%5C
**Post date:** [August 22, 2023, 7:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F10 "2023-08-22T07:18:02Z")

</div>

![Screenshot_20230822-141721_Chrome](https://us1.discourse-cdn.com/hellohellohello/original/3X/3/f/3f6e3439d5d2b332d3c7274666de5474f69e5ffb.png)  
I use your code

---

<div class="post-metadata">

**Author:** ![Geek7](https://avatars.discourse-cdn.com/v4/letter/g/bc8723/32.png) [@Geek7](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FGeek7)%5C
**Post date:** [January 10, 2024, 11:42am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fnegative-prompts-for-the-inference-api%2F31943%2F11 "2024-01-10T11:42:10Z")

</div>

Hi , I want to know about Inference Endpoint. Does it allow all parameters? size,…
