# 500 Internal Server Error when use AsyncInferenceClient

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-when-use-asyncinferenceclient%2F128792%3E%5C
**Category:** Models\
**Created:** [December 2, 2024, 7:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-when-use-asyncinferenceclient%2F128792 "2024-12-02T07:15:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![endlessccl](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/endlessccl/32/36480_2.png) [@endlessccl](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fendlessccl)%5C
**Post date:** [December 2, 2024, 7:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2F500-internal-server-error-when-use-asyncinferenceclient%2F128792%2F1 "2024-12-02T07:15:45Z")

</div>

when I use AsyncInferenceClient,sometimes I recived 500 500 Internal Server Error like this:  
`aiohttp.client_exceptions.ClientResponseError: 500, message='', url='/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FShakker-Labs%2FFLUX.1-dev-LoRA-One-Click-Creative-Template'` .  
My code just like this:

```auto
from huggingface_hub import AsyncInferenceClient

API_URL = "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co%2Fmodels%2FShakker-Labs%2FFLUX.1-dev-LoRA-One-Click-Creative-Template"
headers = {
    "Authorization": "Bearer hf_xxxxxxx",
    "x-use-cache": "false"
}

def query(payload):
    response = requests.post(API_URL, headers=headers, json=payload)
    return response.content

image_bytes = query({
  "inputs": "Astronaut riding a horse",
  "parameters": {
      "width": 512,
      "height": 512
  }
})
print(image_bytes)

```
