# Negative prompts for the inference api

**URL:** <https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943>\
**Category:** 🤗Hub\
**Created:** [February 18, 2023, 12:40am UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943 "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](https://discuss.huggingface.co/u/jetpackjules)\
**Post date:** [February 18, 2023, 12:40am UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/1 "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](https://discuss.huggingface.co/u/jetpackjules)\
**Post date:** [February 27, 2023, 7:10pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/2 "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](https://discuss.huggingface.co/u/radames)\
**Post date:** [February 27, 2023, 9:10pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/3 "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(
  "https://api-inference.huggingface.co/models/stabilityai/stable-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](https://discuss.huggingface.co/u/jetpackjules)\
**Post date:** [February 27, 2023, 9:53pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/4 "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](https://discuss.huggingface.co/u/jetpackjules)\
**Post date:** [February 27, 2023, 10:19pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/5 "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](https://discuss.huggingface.co/u/radames)\
**Post date:** [February 27, 2023, 10:37pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/6 "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](https://discuss.huggingface.co/u/radames)\
**Post date:** [February 27, 2023, 10:45pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/7 "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](https://discuss.huggingface.co/u/jetpackjules)\
**Post date:** [February 27, 2023, 11:06pm UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/8 "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](https://discuss.huggingface.co/u/sjsjd)\
**Post date:** [August 22, 2023, 7:17am UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/9 "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](https://discuss.huggingface.co/u/sjsjd)\
**Post date:** [August 22, 2023, 7:18am UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/10 "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](https://discuss.huggingface.co/u/Geek7)\
**Post date:** [January 10, 2024, 11:42am UTC](https://discuss.huggingface.co/t/negative-prompts-for-the-inference-api/31943/11 "2024-01-10T11:42:10Z")

</div>

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