TLDRocket
Sign in

From OpenAI to Open LLMs with Messages API on Hugging Face

Hugging Face

Hugging Face just made it dead simple to swap OpenAI's API for open models. One line change, same code, models like Mixtral instead of GPT-4.

Based on reporting by Hugging Face — read the original for the full story.

Summary, retelling and take written by AI under human oversight; images are AI-generated illustrations. How we work · Report an error

Hugging Face has quietly removed one of the biggest excuses for staying locked into OpenAI. With version 1.4.0 of Text Generation Inference, the company's model-serving toolkit, there's now a Messages API that speaks the exact same language as the OpenAI Chat Completion API. Point your existing OpenAI client library at a Hugging Face Inference Endpoint instead of api.openai.com, and things just work.

The practical upshot is that a developer running GPT-4 through the standard OpenAI Python or JavaScript SDK can switch to something like Mixtral-8x7B or Nous-Hermes-2-Mixtral-8x7B-DPO by changing essentially one line: the base URL and the API key. Everything else — the message list, the streaming logic, the parameter names like temperature and max_tokens — stays put. Hugging Face walks through deploying a Mixtral fine-tune on a dedicated endpoint using two Nvidia A100 GPUs, then hitting it with the same client code you'd use for OpenAI, streaming tokens back in real time.

This isn't just a party trick for solo developers. Ryght, a GenAI orchestration platform, is already using it in production. CTO Johnny Crupi says the compatibility layer let his team migrate workloads from GPT-4 to Mixtral and Llama 2 on Inference Endpoints without rewriting their integration layer, giving them more control over both cost and behavior. Hugging Face also built in support for LangChain and LlamaIndex, so RAG pipelines that were wired for OpenAI's ChatOpenAI class can point at a TGI endpoint instead, using the same retrieval and prompting logic unchanged.

There are real caveats. The Messages API doesn't support function calling yet, which knocks out a chunk of agentic use cases that lean on tool invocation. It also only works with models that ship a chat_template in their tokenizer config, so this isn't universal — you need a model built to expect structured chat turns, not just raw text completion. Supported parameters are limited too: streaming, max tokens, frequency penalty, logprobs, seed, temperature, top_p, and not much beyond that.

Still, the bigger story here is friction removal. Companies have avoided switching away from OpenAI not because open models were incapable, but because the switching cost — rewriting SDK calls, retooling RAG chains, retraining engineers — felt too high. Hugging Face just deleted most of that cost for anyone willing to self-host or rent an endpoint.

My take — AI-written commentary, not fact-checked reporting

This is exactly the kind of infrastructure work that actually shifts power away from closed-model providers, more than any benchmark chart ever will. Compatibility layers are boring, unglamorous, and they're also the single biggest lever for making open models a default choice instead of a brave one. I'd bet this quietly moves more workloads off OpenAI than any Llama or Mixtral leaderboard win did.

Read more about this at: Hugging Face

Related stories

The daily briefing

Every AI story that matters, in your inbox by 8am.

TLDRocket reads all relevant sources, removes duplicate coverage, and summarises the day in two minutes. Follow companies and topics for alerts, or get the briefing in Slack. Free, no spam, unsubscribe anytime.