Why OpenAI compatibility matters
Most clients in the wild — LangChain, LlamaIndex, your custom shim, the OpenAI SDK itself — speak OpenAI's wire format. HF's Inference Providers accept that format at https://router.huggingface.co/v1. Point an existing OpenAI client at that base URL with your HF token, and models served by any HF-routed provider answer code that thinks it's calling OpenAI.
Compatible means chat, and only chat
The endpoint serves one task: chat completion. HF's own docs label it chat only. Send embeddings or image generation to the same base URL and both /v1/embeddings and /v1/images/generations come back 404. Those tasks go through huggingface_hub's InferenceClient instead: feature_extraction for embeddings, text_to_image for images.
Inside chat, the shapes match OpenAI's: messages, tools, response_format, streaming chunks. Authorization: Bearer ${HF_TOKEN} takes the place of OPENAI_API_KEY, and GET /v1/models lists what you can call.
Same shape is not same capability
Model ids are HF repo ids, not OpenAI model names. A suffix on the id picks how the provider is chosen: no suffix means :fastest, :cheapest takes the lowest price, and a provider name such as :groq pins one.
The trap is that providers differ in what they actually support. /v1/models reports supports_tools and supports_structured_output per provider. In October 2026, four providers served meta-llama/Llama-3.1-8B-Instruct, and only one of them was marked as supporting tool calls. An endpoint that accepts your request JSON makes no promise that the feature behind it works. Rate limits and billing follow HF and the provider you landed on, not OpenAI.