---
title: "How do I switch an app from the OpenAI API to a local model?"
description: "Run a local server with an OpenAI-compatible API, then change the base URL in your app (for example to http://localhost:52415/v1) and set the model name to a local model. Most OpenAI SDKs and tools need no other code changes."
url: https://exolabs.net/faq/replace-openai-api-with-local-model/
updated: 2026-10-26
---

# How do I switch an app from the OpenAI API to a local model?

Run a local server with an OpenAI-compatible API, then change the base URL in your app (for example to http://localhost:52415/v1) and set the model name to a local model. Most OpenAI SDKs and tools need no other code changes.

In the official OpenAI SDKs, set base_url (Python) or baseURL (JavaScript). Many tools read the OPENAI_BASE_URL environment variable.

Local servers usually ignore the API key, but some SDKs require one to be set. Any placeholder value works.

Check features your app relies on, such as tool calling, structured JSON output, image input or the Responses API. Support varies by server and by model.

**Where exo fits:** exo is compatible with OpenAI Chat Completions, OpenAI Responses, Claude Messages and the Ollama API, so apps written for any of them can switch to a local cluster.

Sources:
- [exo on GitHub (README)](https://github.com/exo-explore/exo)
- [OpenAI Python SDK](https://github.com/openai/openai-python)

Page: https://exolabs.net/faq/replace-openai-api-with-local-model/ · Updated 2026-10-26 · Deployments: https://exolabs.net/#business (sales@exolabs.net)
