Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Deploy private hugging face models without sharing your access token
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Deploy private Hugging Face models without sharing your access token

Source: Baseten•November 24, 2026 at 07:36 PM

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.

Security

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.

Authors

Many teams store fine-tuned and proprietary model weights in private Hugging Face repos. Hugging Face Trusted Publishers lets an external platform download those weights for deployment, fine-tuning, or evaluation using a short-lived token instead of a long-lived one.

Until now, the token could also write to the repo. Today, Trusted Publishers supports read-only access. To safely deploy private models, inference providers can use short-lived, read-only tokens to pull your model weights. Because these tokens don't have write access, they can't modify your repo.

We're proud to be the first inference provider to support read-only Trusted Publishers for syncing model weights at deploy time, joining our existing OIDC support for pulling weights from S3 and GCS. We worked with the Hugging Face team to add read-only access to Trusted Publishers, and we'll keep working with partners across the industry to make workload identity and scoped access controls the default for AI infrastructure, replacing long-lived API keys.

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 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 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.

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.

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.

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.

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:

Point your Truss config at the repo:

yaml

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.

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

← All articles

What this article says

More in AI & Machine Learning

All →
Amazon Autos is coming to the UK—the first country outside the US
Amazon

Amazon Autos is coming to the UK—the first country outside the US

The Agent Lake
LangChain

The Agent Lake

Training a Scalable Forecasting Agent (Guest Post with Mantic)
Thinking Machines Lab

Training a Scalable Forecasting Agent (Guest Post with Mantic)

What is agent memory?
Redis

What is agent memory?

How We Achieved ISO 42001 with LangSmith
LangChain

How We Achieved ISO 42001 with LangSmith

Enabling Mid-Epoch Training Resumption with Ray Train
Anyscale

Enabling Mid-Epoch Training Resumption with Ray Train

More from Baseten

Open-weight models beat the closed frontier on legal tasks with Harvey
Baseten

Open-weight models beat the closed frontier on legal tasks with Harvey

Post-train your own medical ASR model to outperform the frontier
Baseten

Post-train your own medical ASR model to outperform the frontier

How we secure 100+ clusters across 20+ clouds
Baseten

How we secure 100+ clusters across 20+ clouds

Meet bison-1 and groundhog-1, frontier American decision models
Baseten

Meet bison-1 and groundhog-1, frontier American decision models

How we secure 100+ clusters across 20+ clouds
Baseten

How we secure 100+ clusters across 20+ clouds

Improved controls for the new era of cyberattacks
Baseten

Improved controls for the new era of cyberattacks