Skip to content
AI News HubLIVE
In-site rewrite3 min read

Deploy private Hugging Face models without sharing your access token

Summary

Baseten partnered with Hugging Face to launch read-only Trusted Publishers, becoming the first inference provider to pull private model weights using short-lived tokens, eliminating the risks of long-lived credentials and excessive permissions.

Deploy private Hugging Face models without sharing your access token
Report an error

The correction channel is not available yet. You can copy the article reference below for later.

Correction instructions
Read article

Deploy private Hugging Face models without sharing your access token

Please rotate your device

To continue exploring this website, please rotate your device to a vertical orientation

Security

Deploy private Hugging Face models without sharing your access token

Baseten partnered with Hugging Face to ship read-only Trusted Publishers, and is the first inference provider to pull private weights with short-lived tokens.

Published

November 24, 2026

Many teams store fine-tuned and proprietary model weights in private Hugging Face repos. Deploying those models on an external platform has usually meant handing over a long-lived access token that works until someone deletes it. Hugging Face Trusted Publishers improved on this by issuing short-lived tokens at deploy time, but until recently, those tokens could also write to your repo, which is more access than a deployment needs.

To maintain a high bar for security, we wanted to go further: no long-lived credentials anywhere, and no access beyond pulling the weights. We asked Hugging Face for a read-only option, and they shipped it within days. Trusted Publishers now supports read-only access, so inference providers get a 1-hour token that can only pull from a single repo and can't modify it.

We're proud to be the first inference provider to support read-only Trusted Publishers, joining our existing OIDC support for pulling weights from S3 and GCS. We'll keep working with partners across the industry to make workload identity and scoped access controls the default for AI infrastructure.

The problem with long-lived Hugging Face tokens

Before Trusted Publishers, the standard way to give a provider like Baseten access to a private model was a long-lived Hugging Face token. A long-lived token has three issues:

It never expires. The token works until you delete it in Hugging Face. If it leaks, anyone who has it can download your private models until you notice and delete it.

It often has more access than it needs. A classic read token can read every private repo you can access, including repos in your Hugging Face organizations.

It’s rarely rotated. To swap in a new token, you need to create it in Hugging Face, update it in Baseten, and delete the old one. Because that takes coordination across two systems, teams often keep the same token.

Trusted Publishers solves these problems by replacing the stored token with short-lived tokens issued at deploy time. But before the read-only option was added, the relevant Trusted Publisher token could both read from and write to the private repository. This meant anyone with that token could modify the repository, even if they only needed to download the model weights.

The solution: temporary, read-only tokens via OIDC

With read-only access, Hugging Face issues a token at deploy time that can only read your repo and expires within an hour.

Read-only Trusted Publishers uses OpenID Connect (OIDC). When you deploy a model, Baseten creates a signed identity token that says which organization and team the deployment belongs to and what type of workload it is (for example, a model build, which downloads the model’s weights). Hugging Face checks the signature and compares the organization, team, and workload type to your Trusted Publisher settings. If they match, it issues the short-lived, read-only token. There’s no long-lived token that can be leaked or needs to be rotated.

How a deployment gets a Hugging Face token. The claims are the deployment’s organization, team, and workload type.

To set up Hugging Face OIDC on Baseten:

Get your Baseten IDs: Find your organization and team IDs with the Baseten CLI. These tell Hugging Face which Baseten workloads to trust.

Add Baseten as a read-only Trusted Publisher: In your Hugging Face repo settings, add Baseten, scope it to your organization and team, and set it to Read-only.

Point your Truss config at the repo:

yaml

weights:

  • source: hf://acme/private-model@main

mount_location: /models/private-model auth: auth_method: HF_OIDC hf_oidc_resource: acme/private-model

For step-by-step instructions, including gated models and volume sync, see the setup guide.

Building secure defaults for AI infrastructure

Attackers have always gone after long-lived credentials and privileged access, but agent-driven attacks now move from a leaked key to stolen data in minutes. Read-only Trusted Publishers is one of many controls we've added to stay ahead of these threats. This post is part of our security series, where engineers across Baseten share how we protect customer models and data, from cluster hardening to identity and access management.

Stay tuned for another blog on API key hygiene in the coming weeks. Learn more about our overall security stance, and how we secure the hardware we run on.

If you want to dive deeper into any of these topics with our engineers, reach out!

Key points and analysis

Article intelligence

EngineersAdvanced

Key points

  • Hugging Face Trusted Publishers now supports read-only access, issuing a 1-hour token at deploy time that can only pull from a single repo.
  • Long-lived tokens never expire, often have excessive access, and are rarely rotated, risking private model leaks or tampering.
  • The new solution uses OIDC: Baseten creates a signed identity token at deploy time, and Hugging Face verifies organization, team, and workload type before issuing a short-lived read-only token.
  • Baseten is the first inference provider to support read-only Trusted Publishers, joining its existing OIDC support for pulling weights from S3 and GCS.

Highlights and analysis are generated automatically and may contain errors. Check the original source.