also I made a write access token in my hugging face account it give me error 401 authentication error
test code
import os
from huggingface_hub import InferenceClient
# Paste your Hugging Face token here
hf_token = “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”
# Initialize the client with your token
client = InferenceClient(token=hf_token)
completion = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V3-0324",
messages=\[
{
“role”: “user”,
“content”: “How many 'G’s in ‘huggingface’?”
}
],
)
# The expected answer is two 'G’s.
print(completion.choices[0].message.content)
output:
---------------------------------------------------------------------------
HTTPError Traceback (most recent call last)
/usr/local/lib/python3.12/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
406 try:
--> 407 response.raise_for_status()
408 except HTTPError as e:
7 frames
HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/models/deepseek-ai/DeepSeek-V3-0324?expand=inferenceProviderMapping
The above exception was the direct cause of the following exception:
HfHubHTTPError Traceback (most recent call last)
/usr/local/lib/python3.12/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
478 # Convert `HTTPError` into a `HfHubHTTPError` to display request information
479 # as well (request id and/or server error message)
--> 480 raise _format(HfHubHTTPError, str(e), response) from e
481
482
HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/models/deepseek-ai/DeepSeek-V3-0324?expand=inferenceProviderMapping (Request ID: Root=1-68f1dae6-45587e2f70b800b13e53e74a;0b23f450-0491-4f8a-80b5-1c6d593c1b81)
Invalid credentials in Authorization header