跳到正文
Baseten 工程博客·· 2 小时前AI 评分48

Baseten 支持 Hugging Face 只读 Trusted Publishers,部署私有模型无需共享访问令牌

Deploy private Hugging Face models without sharing your access token

AI 导读

Baseten 与 Hugging Face 合作上线只读 Trusted Publishers,成为首家在部署时用短期令牌拉取私有模型权重的推理服务商。部署时 Baseten 通过 OIDC 签发身份令牌,Hugging Face 校验组织、团队与工作负载类型后发放一小时内过期的只读令牌,无法修改仓库。该能力与此前支持从 S3、GCS 拉取权重的 OIDC 机制并列。

正文 · 原文

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

Published

November 24, 2026

Deploy private Hugging Face models without sharing your access token

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

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

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

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

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

来源:Baseten 工程博客 · baseten.co