Switch from OpenAI to open-weight models: what changes

Moving an app from OpenAI to an open-weight model can start with a small code change. Whether it ends there depends on which features your app uses.

Several servers and gateways copy OpenAI's API, so existing client code can often point at them. The copy is not complete, and the gaps tend to show up in tool calls, structured output and parameters.

What can stay the same

Hugging Face says its Text Generation Inference server "supports the Messages API, which is fully compatible with the OpenAI Chat Completion API". Its Messages API page tells you to "replace base_url with your endpoint URL and to include v1/ at the end of the URL".

The vLLM project says its server is "compatible with many interfaces". OpenRouter, a gateway to many models, says you can use the OpenAI SDK pointed at it as "a drop-in replacement".

In practice the change is a new base URL, a new key and the model name the other server uses. OpenAI model names do not carry over. Hugging Face repository names and provider/model names are examples.

What may not carry over

Chat format. vLLM says its chat endpoint works only for text generation models with a chat template. "Without a chat template, the server will not be able to process chat and all chat requests will error."

Tool calls. vLLM says that with parallel_tool_calls set to true there is "no guarantee more than one tool call will be returned", because it is model dependent. OpenRouter says that with tools it "makes a best effort to route to providers known to support tool use".

Parameters. vLLM says its user parameter is ignored. OpenAI's own reference says support "can differ depending on the model", and that newer models reject an explicit n. OpenRouter has a require_parameters option, which defaults to off, so a request can be routed to a provider that ignores some of your settings.

Structured output. OpenAI says its json_schema setting makes the model match your schema. The vLLM and Hugging Face pages we read did not confirm the same feature, so test it on your server.

Which API your code uses. OpenAI recommends its newer Responses API over Chat Completions. Some compatible servers copy only one of them, so check which your code calls.

Things the base URL does not fix

Open-weight models differ from OpenAI's in quality on your tasks, in speed and in cost. Licences differ too, so read each one. Someone also has to run the server, or you choose a provider that does. We cover that in what it takes to run an open model yourself and in open-weight vs paid AI models.

A short plan

  1. List which API features your app uses: streaming, tools, structured output, long context.
  2. Pick a compatible server or provider for each candidate model.
  3. Change the base URL, key and model name in a test copy.
  4. Run your own prompts and compare the answers with what you have now.
  5. Test every tool call and every structured output path.
  6. Check the model licence and where requests are processed.
  7. Keep the old route as a fallback until the new one has run for a while.

Starfield take

Test with your own prompts, not a benchmark. The base URL change is the easy part, and quality on your task is the part that decides.

What we are building

We are building Starfield Fabric: standardized compute close to power, connectivity and demand, connected through one programmable network for AI inference. Workloads are designed to be placed by policy, on latency, data residency, model and load, and every workload can generate an auditable record of commitment, placement and delivery.

Related: Open-weight vs paid AI models

Related

Starfield Fabric · What it takes to run an open model yourself · Open-weight vs paid AI models: what is the difference?