# Api Text-to-Image

**URL:** <https://discuss.huggingface.co/t/api-text-to-image/42969>\
**Category:** Beginners\
**Created:** [June 12, 2023, 6:28pm UTC](https://discuss.huggingface.co/t/api-text-to-image/42969 "2023-06-12T18:28:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blansj](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@blansj](https://discuss.huggingface.co/u/blansj)\
**Post date:** [June 12, 2023, 6:28pm UTC](https://discuss.huggingface.co/t/api-text-to-image/42969/1 "2023-06-12T18:28:31Z")

</div>

[GuoFeng3](https://huggingface.co/xiaolxl/GuoFeng3)  
api Text-to-Image  
How to set optional parameters?

---

<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:** [June 12, 2023, 7:24pm UTC](https://discuss.huggingface.co/t/api-text-to-image/42969/2 "2023-06-12T19:24:52Z")

</div>

hi @blansj  
Not possible to change params via WidgetUI, however you you can explore the API Inference with rate limit via simple requests, or using or [Python client](https://huggingface.co/docs/huggingface_hub/guides/inference) or [JavasScript client](https://huggingface.co/docs/huggingface.js/index), here is an example with JS,

```js
(async () => {
  const PROMPT =
    "best quality masterpiece highres 1girl china dress Beautiful face";
  const NEGATIVE_PROMPT =
    "NSFW, lowres,bad anatomy,bad hands, text, error, missing fingers,extra digit, fewer digits, cropped, worstquality, low quality, normal quality,jpegartifacts,signature, watermark, username,blurry,bad feet";
  const HF_TOKEN = ""; //with TOKEN you have more images
  const HFInference = (
    await import("https://cdn.jsdelivr.net/npm/@huggingface/inference/+esm")
  ).HfInference;
  const hf = new HFInference(HF_TOKEN);
  await hf
    .textToImage({
      inputs: PROMPT,
      parameters: {
        negative_prompt: NEGATIVE_PROMPT,
        width: 768,
        height: 768
      },
      model: "xiaolxl/GuoFeng3"
    })
    .then((blob) => {
      window.open(URL.createObjectURL(blob), "_blank");
    });
})()

```
