๐จ Revoke leaked tokens with hf auth revoke
If a token ever leaks โ committed to a repo, pasted in a log, shared in a snippet โ you can now revoke it right away with hf auth revoke. Revocation doesn't require being logged in: anyone holding the raw value of a token can revoke it, and the token owner gets notified by email. To rule out footguns, the request is deliberately sent without your own Authorization header, so your active token can never be revoked by mistake. The same is available in Python with the new top-level revoke_tokens() helper, which sends tokens in batches of 1000. Note that the Hub always answers with a generic "revocation requested" message, whether the token existed or not.
>>> hf auth revoke hf_xxx hf_yyy
โ Revocation requested for 2 token(s)
count: 2>>> from huggingface_hub import revoke_tokens
>>> revoke_tokens(["hf_xxx"])๐ Documentation: hf auth revoke in the CLI guide ยท revoke_tokens() reference
๐ Sandbox network policies: no internet access, or an allowlist
Sandboxes can now run without internet access, or with access restricted to an allowlist. Pass network="none" to block all outbound connections, or network={"allow": [...]} with IP ranges, IPs (optionally with a port) and hostnames โ for example, to let an agent in a sandbox reach your internal vLLM server and the Hub, and nothing else. The policy is enforced by the sandbox server with seccomp and Landlock, applies to every process the sandbox starts, and cannot be removed from inside the sandbox, even by root. Pools support it per-sandbox too, so one host can run isolated and connected sandboxes side by side. If the server cannot apply the policy (e.g. a pool host started by an older version of huggingface_hub), creation fails with a SandboxError instead of silently returning a connected sandbox.
sbx = Sandbox.create("python:3.12", network="none") # volumes still work
sbx = Sandbox.create("python:3.12", network={"allow": ["10.0.0.0/8", "203.0.113.10:443", "huggingface.co"]})
agent = pool.create(network="none") # pools can mix isolated and connected sandboxeshf sandbox create --network none
hf sandbox create --network 10.0.0.0/8,huggingface.co:443๐ Documentation: Sandboxes guide
๐ฆ Query datasets with hf_dataset() in hf datasets sql
hf datasets sql now auto-installs and loads the Hugging Face DuckDB extension, so you can query a dataset with hf_dataset('org/name') instead of hand-building read_parquet(...) URLs against the Dataset Viewer. This is a nice ergonomics win for agents previewing datasets, and as a side effect it also enables writing back to the Hub with COPY ... TO 'hf://datasets/username/dataset-name/...'. The extension requires DuckDB 2.0+; if it cannot be installed (older DuckDB or an unsupported platform), a warning is logged and existing read_parquet workflows keep working unchanged.
>>> hf datasets sql "SELECT * FROM hf_dataset('stanfordnlp/imdb') LIMIT 3"๐ Documentation: hf datasets sql in the CLI guide
๐พ fsspec transactions for buckets
HfFileSystem now supports fsspec transactions for buckets. Files written inside a fs.transaction block are uploaded when the block ends, and nothing is uploaded if the block raises. This unlocks libraries that wrap every save in a transaction, such as PyTorch Lightning's _atomic_save, which previously could not write checkpoints to hf://buckets/... paths. Transactions are best-effort (each file is uploaded separately on commit, so a failure can leave earlier files uploaded) and buckets-only: repo writes, rm and cp_file inside a transaction raise a NotImplementedError before any upload or delete.
>>> with hffs.transaction:
... with hffs.open("buckets/my-username/my-bucket/checkpoints/last.ckpt", "wb") as f:
... f.write(data)
... # not uploaded yet
>>> # uploaded now๐ Documentation: Transactions in the HfFileSystem guide
- [HfFileSystem] Support fsspec transactions for buckets by @davanstrien in #5272
- [Docs] Document HfFileSystem transactions for buckets by @davanstrien in #5332
๐ Spaces OAuth without a client secret (PKCE)
OAUTH_CLIENT_SECRET is now optional when adding Hugging Face OAuth to a Space. PKCE (S256) is always enabled: without a secret, the Space authenticates as a public OAuth client (token_endpoint_auth_method="none"), while Spaces that still receive a client secret keep working as before. Session cookies are now signed with a key derived from SPACE_SIGNING_SECRET โ a stable per-Space secret injected by the Hub โ instead of OAUTH_CLIENT_SECRET, so sessions survive restarts and are shared across replicas, and secretless Spaces no longer share a predictable cookie key. Heads-up: the signing key changes with this release, so users logged in to an OAuth Space will need to log in again once the Space upgrades huggingface_hub.
- Make OAuth client secret optional for Spaces (PKCE support) by @moon-bot-app[bot] in #4578
๐ค Chat completions routed through the Hub router
When calling chat_completion with a Hugging Face token and a specific provider, requests now go through the Hub router at /v1/chat/completions with model set to hf-model-id:provider, instead of calling provider-specific routes directly. Provider routes skip the router's server-side routing (auto, :cheapest/:fastest/:preferred policies, model pinning), so pinned-provider calls now follow exactly the same path as auto calls and the Hub code snippets, with OpenRouter picking a serving provider and failing over automatically if one is down or rate limited. Calls with a provider API key are unchanged and still reach the provider directly, and the chat provider helpers dropped by this change are no longer needed by the client.
๐ Documentation: Inference guide
- [Inference Providers] Route chat through the router and drop chat provider helpers by @hanouticelina in #5333
๐ฅ๏ธ CLI
- [CLI] Fix --format guidance in the generated hf-cli skill by @hanouticelina in #5286
- [CLI] Fix visibility help in
hf repos settingsby @sergiopaniego in #5379 - [CLI] List global formatting flags in the generated CLI reference by @moon-bot-app[bot] in #5438
๐ Jobs
- [Jobs] Use the client to resolve the list_jobs namespace by @mertkayacs in #5285
- [Jobs] Keep auto-generated Job names within the 100-character limit by @sergiopaniego in #5306
- [Jobs] Clear error for an invalid --timeout value by @sergiopaniego in #5386
- [Jobs] Use the script file name as default Job name on Windows paths by @Wauplin in #5388
- [Jobs] Fix run_uv_job crash on long script arguments by @davanstrien in #5424
๐งช Sandbox
- [Sandbox] Prune cached pool hosts whose job no longer exists by @CharlesXmf in #5375
๐ค Inference
- [Inference] Keep the client alive while its response is streamed by @ShaanGS in #5399
- [Endpoints] Use the HfApi client token for returned endpoints by @AyeshaWaseemAhmad in #5331
๐ง Other QoL Improvements
- [Spaces] Add visibility field to SpaceInfo by @Wauplin in #5295
- [Discussions] Expose diff_url on DiscussionWithDetails and use it in hf discussions diff by @TejasLamba2006 in #5341
- [HTTP] Raise
EgressLimitErroron 402EgressLimitReachedby @Wauplin in #5434 โ docs - Type
JobStatus.stageandSpaceRuntime.stageasEnum | strby @davanstrien in #5440
๐ Documentation
- [Docs] Remove community translations, hf.co/docs is now machine-translated by @hanouticelina in #5277
- [Docs] Fix the CLI extension build backend by @shuaiyafei in #5288
- [Docs] Include provider options in endpoint deploy example by @shuaiyafei in #5299
- [Docs] Use text classification in the FinBERT endpoint example by @shuaiyafei in #5307
- Fix docs/source path in AGENTS.md by @vishwakulkarni in #5319
- [Docs] Fix 404 doc links in the German and Chinese READMEs by @Kernel-Hunter in #5323
- Clarify which remote endpoints each hf cp command accepts by @student-shivamm in #5334
- [Docs] Fix get_discussion_details example in community guide by @0PeterAdel in #5338
- [Docs] Fix the single-file test example in CONTRIBUTING by @mayin0902 in #5349
- [Docs] Require bug discovery context in issues and PRs by @Wauplin in #5356
- [Docs] Fix the dead Zarr link in the HfFileSystem guide by @farisbasha in #5367
- [Docs] Fix stale UV job examples in the Jobs and CLI guides by @Toraastrta in #5400
- Fix ACCELERATOR and MEMORY in the Jobs env var table by @davanstrien in #5404
- [Docs] Fix the Jobs labels example by @AyhamJo7 in #5407
- [Docs] Fix the dead Polars link in the HfFileSystem guide by @sarankumar1325 in #5417
- [Docs] Document the HF_JOB_* environment variables in the Jobs and CLI guides by @christophe-rannou in #5435
- [Docs] Fix
hf cache lsandhf endpointsstatements in CLI guides by @davanstrien in #5437
๐ Bug and typo fixes
- [HfFileSystem] Raise FileExistsError on exclusive create of existing files by @mirzasnowy in #5282
- fix(hf_file_system): reject write modes in streaming files by @MonikaDvorackova in #5287
- [HfFileSystem] Fix last_commit of repo root in info() by @hyeonsang010716 in #5326
- [HfFileSystem] Fix info(refresh=True) parent cache by @zhengdaodeguL in #5364
- [HfFileSystem] Fix info() on a stale bucket listing by @SyN-droMe in #5384
- [Webhooks] Require complete configuration on update by @Wauplin in #5302
- [Buckets] Read --filter-from files as UTF-8 by @Alpenj in #5310
- [HTTP] Parse kernel repos from API URLs in errors by @lbarrosby in #5313
- [HTTP] Drop empty parts from the User-Agent header by @Wauplin in #5368
- [RepoCard] Read the target revision in metadata_update by @gorkadabo1 in #5330
- [Download] Don't write the ref file in snapshot_download dry runs by @anishmehta24 in #5345
- [Download] Honor force_download before snapshot cache fallback by @remote-controlled-man in #5351
- [Download] Don't write download metadata during local-dir dry runs by @Nixxx19 in #5362
- [Download] Fix concurrent downloads into local_dir by @Wauplin in #5353
- [Upload] Isolate Xet cancellation on pipeline failures by @Wauplin in #5352
- [Cache] Count shared blobs once in revision totals by @Ayushdevo in #5378
- [CLI] Count shared blobs once with --limit and --filter by @shashank11yadav in #5394
- [CLI] Return status code from ReloadClient.get_reload on non-200 responses by @Yshuro in #5385
- [PaperInfo] Retain nested metadata fields in list_daily_papers and list_papers by @uvcode01-max in #5358
- [HubMixin] Load pytorch_model.bin from a local dir like from the Hub by @caiotheodoro in #5415
- Fix list_repo_likers dropping is_pro by @Hirtik786 in #5418
- Preserve device index when map_location is a torch.device by @Mashfiya-Shaikhrahim03 in #5427
- [Utils] Handle unsupported flock with newer filelock by @09Catho in #5340
๐๏ธ Internal
- Post-release: bump version to 2.5.0.dev0 by @huggingface-hub-bot[bot] in #5279
- [Tests] Fix test_validate_repocard for new Hub license error message by @Wauplin in #5296
- [Tests] Don't tie RepoCard line-ending test to the OS by @Aschenbath in #5300
- [Fastai] Replace toml with tomllib and tomli by @dimbleby in #5312
- Fix CI type error from click 8.5.1 in HfArgument by @Wauplin in #5322
- [CI] Fix ty 0.0.100 failures from the unresolved-attribute rule split by @hanouticelina in #5335
- [CI] Fix ty 0.0.105 missing-module-member errors on hf_xet by @Wauplin in #5369
- [CI] Drop model card consistency reminder workflow by @Wauplin in #5370
- [Tests] Fix live inference provider mapping tests (DeepSeek-R1 has no providers anymore) by @Wauplin in #5436