Skip to content

processJsonConfig

processJsonConfig(llmConfig): Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>>

Defined in: _worktrees/docs-release/gaunt-sloth/packages/core/src/providers/huggingface.ts:35

Hugging Face Inference Providers — OpenAI-compatible router.

HF exposes a single OpenAI-compatible Chat Completions endpoint at https://router.huggingface.co/v1 that fans requests out to the configured inference provider (Cerebras, Groq, Together, SambaNova, hf-inference, …). It supports tool/function calling, streaming and structured outputs, so we reuse LangChain’s ChatOpenAI exactly like the OpenRouter provider — no dedicated @langchain/huggingface package is needed (the JS @langchain/community HuggingFaceInference is a text-completion LLM with no bindTools, so it is unusable for the agent loop).

Auth uses a Hugging Face user access token with the “Inference Providers” permission, read from HF_TOKEN (canonical) or the HUGGINGFACEHUB_API_TOKEN / HF_API_KEY aliases.

Model ids are Hub repo ids, e.g. openai/gpt-oss-120b. You may append a provider/policy suffix understood by the router (:groq, :cheapest, :fastest); it is part of the model id and passes straight through.

OpenAIChatInput & ChatOpenAIFields & BaseLanguageModelParams & object

Promise<BaseChatModel<BaseChatModelCallOptions, AIMessageChunk<MessageStructure<MessageToolSet>>>>