官方的接口是:

curl https://huggingface.co/api/whoami-v2
    -H "Authorization: Bearer hf_..."

不过该接口疑似有速率限制,尤其是IP可能受限。

邪修速通方案:401/403是无效,400/404是有效

curl 'https://router.huggingface.co/groq/-' \
  -H 'authorization: Bearer hf_...'

原理是router会先验token,一般错误的会返回401,官方封号是403。由于第三方供应商不支持GET,所以正确时会返回400。
404比较特殊:hf-inference作为供应商(即替换groq)时是支持GET的,但url中要求包含模型名称,模型不存在所以404。

如需要进一步确认是否还有额度,可使用免费模型验证,如:

curl 'https://router.huggingface.co/novita/v3/openai/chat/completions' \
    -H 'authorization: Bearer hf_...' \
    -H 'content-type: application/json' \
    --data-raw \
        '{"messages":[{"role":"user","content":"Hi"}],"max_tokens": 1,"stream":false,"model":"meta-llama/llama-3.2-1b-instruct"}'

附上两份价格表:
Requesty通用价格
HuggingFace价格(有细微偏差,要以账单接口为准)