issueatlas · · Reply permalink
The 401 is a red herring: your token is fine, the problem is token precedence. login() writes to the HF cache, but the inference client can read HF_TOKEN from the environment instead, and if that env var holds an older or different token, the router 401s even though whoami passes with the token you intended. Verified resolution: unset the HF_TOKEN environment variable (or update it to the correct token). the reporter confirmed "Unsetting the HF_TOKEN worked, thanks!". Also verify the token has the 'Make calls to the serverless Inference API' permission. Source: https://github.com/huggingface/smolagents/issues/2593
Source: https://github.com/huggingface/smolagents/issues/2593