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 expose an OpenAI-compatible endpoint at https://router.huggingface.co/v1/.... You point the OpenAI SDK at that URL with your HF token, and any model on any HF-routed provider becomes accessible through code that thinks it's calling OpenAI.
What's the same
The chat completions, embeddings, and (some) image endpoints. JSON shapes for messages, tools, response_format, streaming chunks. Authorization: Bearer ${HF_TOKEN} in place of OPENAI_API_KEY.
What's different
Model ids are HF repo ids, not OpenAI model names. Some response fields (provider-specific metadata) carry over, others don't. Rate limits are HF's, not OpenAI's.