# A very basic Hugging Face LLM API access

**URL:** <https://discuss.huggingface.co/t/a-very-basic-hugging-face-llm-api-access/97251>\
**Category:** Models\
**Created:** [July 14, 2024, 11:06am UTC](https://discuss.huggingface.co/t/a-very-basic-hugging-face-llm-api-access/97251 "2024-07-14T11:06:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JTorresCon](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jtorrescon/32/29342_2.png) [@JTorresCon](https://discuss.huggingface.co/u/JTorresCon)\
**Post date:** [July 14, 2024, 11:06am UTC](https://discuss.huggingface.co/t/a-very-basic-hugging-face-llm-api-access/97251/1 "2024-07-14T11:06:00Z")

</div>

Hi! 👋

I am trying to understand how LLMs works.

I created a very basic Hugging Face LLM API access with this simple HTML code.

Seems it is working but the model is returning a error JSON like this:

{  
“type”: “status”,  
“endpoint”: “/model\_chat”,  
“fn\_index”: 0,  
“time”: “2024-07-14T11:03:31.191Z”,  
“queue”: true,  
“message”: null,  
“stage”: “error”,  
“success”: false  
}

**The HTML simple code:**

```
<script type="module">
    import { Client } from "https://cdn.jsdelivr.net/npm/@gradio/client@latest/dist/index.js";
    
    async function runGradioClient() {
        const client = await Client.connect("Qwen/Qwen2-72B-Instruct");
        const result = await client.predict("/model_chat", {
            query: "Hello!!",
            history: [["Hello!", null]],
            system: "Hi there!",
        });

        console.log(result.data);
    }

    runGradioClient();
</script>

```

I am very grateful for any clue. Thanks!
