# Q: How to query Inference Endponts for Feature Extraction task

**URL:** <https://discuss.huggingface.co/t/q-how-to-query-inference-endponts-for-feature-extraction-task/78576>\
**Category:** Inference Endpoints on the Hub\
**Created:** [March 22, 2024, 4:32am UTC](https://discuss.huggingface.co/t/q-how-to-query-inference-endponts-for-feature-extraction-task/78576 "2024-03-22T04:32:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeee](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mikeee/32/3485_2.png) [@mikeee](https://discuss.huggingface.co/u/mikeee)\
**Post date:** [March 22, 2024, 4:32am UTC](https://discuss.huggingface.co/t/q-how-to-query-inference-endponts-for-feature-extraction-task/78576/1 "2024-03-22T04:32:09Z")

</div>

Hi.

The doc on **Feature Extraction task** ([https://huggingface.co/docs/api-inference/detailed\_parameters#feature-extraction-task](https://huggingface.co/docs/api-inference/detailed_parameters#feature-extraction-task)) does not provide an example (there is an example for almost all other tasks).

I tried:

```auto
import os
import requests

API_TOKEN = os.getenv("HF_TOKEN")
if not API_TOKEN:
  API_TOKEN = input("Paste your HF_TOKEN here: ")
MODEL_ID = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2"
API_URL = f"https://api-inference.huggingface.co/models/{MODEL_ID}"
headers = {"Authorization": f"Bearer {API_TOKEN}"}

payload = {"inputs": "test"}
response = requests.post(API_URL, headers=headers, json=payload)

response.json()
# {'error': ['Input should be a valid dictionary or instance of SentenceSimilarityInputsCheck: received `test` in `parameters`']}

```

which does not work. I tried a few other things and tried searching the web but can’t figure out the answer.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![mikeee](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mikeee/32/3485_2.png) [@mikeee](https://discuss.huggingface.co/u/mikeee)\
**Post date:** [March 22, 2024, 5:46am UTC](https://discuss.huggingface.co/t/q-how-to-query-inference-endponts-for-feature-extraction-task/78576/2 "2024-03-22T05:46:07Z")

</div>

OK I sort of figured out: using huggingface\_hub.InferenceClient instead

```auto
from huggingface_hub import InferenceClient
client = InferenceClient(model=MODEL_ID, token=API_TOKEN)

arr = client.feature_extraction(["test"])

```

Quite fast response: ~20s for 1000 avarage paragraphs from colab.
