Payment Issues - Langchain/ Iterative Summarisation

Hi,
I am working on iterative summarisation of long documents using Qwen/Qwen2.5-14B-Instruct-1M via langchain’s HuggingFaceEndpoint.

Despite using an access token from a Pro account to login, I get the following error:
Error processing batch 1: 402, message=‘Payment Required’, url=‘https://router.huggingface.co/featherless-ai/v1/chat/completions

The link shows the following: {“error”:“Invalid username or password.”} which is confusing based on the error message.

Has anyone encountered similar?

1 Like

Hey Fyahdii! That 402 error with the “Invalid username or password” message is odd, especially with a Pro account. I’ve hit similar issues with Hugging Face’s API when the token wasn’t set up right. Check that your HUGGINGFACEHUB_API_TOKEN is correctly loaded in your environment (e.g., via os.environ or .env) and matches the token from your Hugging Face account settings—copy-paste can sometimes add hidden characters. Also, verify the repo_id for Qwen/Qwen2.5-14B-Instruct-1M is correct, as a mismatch can cause errors. Could you share a snippet of how you’re initializing HuggingFaceEndpoint? Has anyone else seen 402 errors with Qwen models on LangChain?

1 Like

For 402 error, refer this:

Thank you for responding and for your help. I think I have been able to resolve this by generating a new token and using that one instead.

1 Like

Nevermind the error came back again

1 Like

Here is my code snippet: llm = HuggingFaceEndpoint(
repo_id=“Qwen/Qwen2.5-14B-Instruct-1M”,
task=“text-generation”,
max_new_tokens=20,
do_sample=False,
repetition_penalty=1.03,
temperature=0.00
)

chat = ChatHuggingFace(llm=llm, verbose=True)

1 Like

It seems that this may also occur due to permission settings on Hugging Face’s side?

Thanks for your help. Based on the linked post, the token I am using appears to have the correct permissions, and there is a payment method with an active subscription on the account, so I suspect it’s most likely something else. Do you know how I might check the permission settings?

1 Like

Hmm… I don’t know how to check that on the user side…
It may be quicker to contact Hugging Face. @meganariley billing@huggingface.co

Thank you, will do so

1 Like