← All notes

InferenceClient: one client for providers, endpoints, local servers

Answer: huggingface_hub gives one unified interface to run inference on Hub-hosted models across multiple services. InferenceClient is a Python client making HTTP calls to these APIs.

Three targets

  1. Inference Providers: unified access to hundreds of models through serverless inference partners.
  2. Inference Endpoints: dedicated, fully managed deployments on a cloud provider of your choice.
  3. Local endpoints: local inference servers like llama.cpp, Ollama, vLLM, LiteLLM, or TGI.

Model and provider ids

With a provider, pass the model's Hugging Face Hub id, not the id the third-party provider uses. The default provider value is "auto", which selects the first available provider sorted by the user's order in settings.

Chat

chat_completion generates a response from a list of messages; the output follows the OpenAI specification.

Auth

HF_TOKEN overrides the token stored on the machine.

Artifacts

See also

Claims

Sources

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Hugging Face docs (huggingface/transformers, huggingface/huggingface_hub, huggingface/diffusers on GitHub), Apache License 2.0 (https://www.apache.org/licenses/LICENSE-2.0). Text was condensed and changed from the originals.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Hugging Face docs, Run Inference on servers, Apache-2.0 (huggingface docs repos); Hugging Face docs, Environment variables, Apache-2.0 (huggingface docs repos).

Cite this

Permanent ID: iil:note:q42zgqnc

iinventedlight. 2026. "InferenceClient: one client for providers, endpoints, local servers." iinventedlight Library, iil:note:q42zgqnc, version of 2026-11-09. https://iinventedlight.com/library/notes/hf-hub-inference-client/. License: CC-BY-4.0.

@misc{iil_note_q42zgqnc,
  author = {{iinventedlight}},
  title = {{InferenceClient: one client for providers, endpoints, local servers}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-09},
  url = {https://iinventedlight.com/library/notes/hf-hub-inference-client/},
  note = {Permanent ID iil:note:q42zgqnc. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com.

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/hf-hub-inference-client.md.