# Secrets for custom inference endpoint?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsecrets-for-custom-inference-endpoint%2F68264%3E%5C
**Category:** Inference Endpoints on the Hub\
**Created:** [January 7, 2024, 3:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsecrets-for-custom-inference-endpoint%2F68264 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fhbredin)%5C
**Post date:** [January 7, 2024, 3:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsecrets-for-custom-inference-endpoint%2F68264%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjulien-c)%5C
**Post date:** [January 8, 2024, 4:59pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsecrets-for-custom-inference-endpoint%2F68264%2F2 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [January 9, 2024, 1:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fsecrets-for-custom-inference-endpoint%2F68264%2F3 "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.
