# Secrets for custom inference endpoint?

**URL:** <https://discuss.huggingface.co/t/secrets-for-custom-inference-endpoint/68264>\
**Category:** Inference Endpoints on the Hub\
**Created:** [January 7, 2024, 3:28pm UTC](https://discuss.huggingface.co/t/secrets-for-custom-inference-endpoint/68264 "2024-01-07T15:28:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hbredin](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/hbredin/32/31902_2.png) [@hbredin](https://discuss.huggingface.co/u/hbredin)\
**Post date:** [January 7, 2024, 3:28pm UTC](https://discuss.huggingface.co/t/secrets-for-custom-inference-endpoint/68264/1 "2024-01-07T15:28:42Z")

</div>

I am in the process of creating an inference endpoint of a gated model.

I went through the documentation but could not find a secure way of passing an authentication token to the custom handler.

It seems that secrets and environment variables are only available in spaces, but not in inference endpoints.

Here is [a link](https://huggingface.co/pyannote/speaker-diarization-3.1/blob/main/handler.py) to my custom handler and to the [corresponding space](https://huggingface.co/spaces/pyannote/pretrained-pipelines) that works fine thanks to a secret.

I could hard code the token and make the model private to avoid leaking the token but that does not seem right.

Any suggestion?

---

<div class="post-metadata">

**Author:** ![julien-c](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/julien-c/32/41937_2.png) [@julien-c](https://discuss.huggingface.co/u/julien-c)\
**Post date:** [January 8, 2024, 4:59pm UTC](https://discuss.huggingface.co/t/secrets-for-custom-inference-endpoint/68264/2 "2024-01-08T16:59:12Z")

</div>

Secrets in Inference Endpoints are not available yet, but they’re on the roadmap

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [January 9, 2024, 1:06pm UTC](https://discuss.huggingface.co/t/secrets-for-custom-inference-endpoint/68264/3 "2024-01-09T13:06:40Z")

</div>

Closed on January 9, 2024, 1:06pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
