How the Ollama OpenAI-compatible API helps teams move existing apps to self-hosted models
Teams with an application built on the OpenAI SDK can often keep that code and point it at models running inside their own infrastructure. Ollama makes this possible because it exposes a REST API on port 11434 with OpenAI compatibility, so the main change is usually the base URL and the model name. The local endpoint does not require authentication, which makes it quick to test on a workstation or a lab server. The harder part is confirming which endpoints and request fields your application actually calls, because compatibility is partial and the gaps tend to appear in the features your code depends on most.
Start by inventorying the calls the application makes: chat completions, embeddings, streaming, tool calling, structured output and any parameters such as logprobs or tool_choice. Check each one against Ollama's current documentation and your own test runs rather than assuming full parity with the hosted service. The result decides whether a direct switch is realistic for the whole application or whether some features need code changes or a different path. Keep in mind that the default bind address is 127.0.0.1, so other services can only reach the API after you deliberately change OLLAMA_HOST and place the server behind controls you own.
Choose this path when the application mainly needs a chat or embedding call swapped to a model you host, and when a small set of verified calls covers its needs. Use Ollama's native API instead when you need Ollama-specific model management or options that the compatibility layer does not expose, and confirm the exact field list against the Ollama FAQ and the project repository before committing. Either way, record the tested behavior in your change records so auditors and security reviewers can trace what the application relies on.
Pointing an OpenAI client at Ollama step by step
This sequence takes an existing OpenAI client from a stock configuration to a verified connection with a self-hosted Ollama server, so the application's first request is known to work before any production traffic reaches it. It is written for the engineer who owns the application and the platform engineer who runs the server.
Confirm the server is running and reachable
On the machine that hosts Ollama, check that the service is up and answering on port 11434. From the application host or a test machine, request the version or tags endpoint with curl against the server address. A JSON response confirms that the network path, firewall rules and process are working. If the request fails from another machine but succeeds on the host, the bind address is the likely cause and the next step covers it.
Verify the bind address set through OLLAMA_HOST
Ollama binds to 127.0.0.1 on port 11434 by default. Check the environment of the Ollama service for the OLLAMA_HOST variable, which changes the bind address when it is set. A server that the application reaches from another container or host needs a bind address that the client can route to, and the address should match only the networks you intend to serve. Record the address you confirmed, because the base URL in the next step depends on it. If you expose Ollama through a reverse proxy such as Nginx, confirm the proxy path here, since the FAQ describes that pattern.
Set the base URL to the Ollama /v1 path
In the OpenAI client configuration, set the base URL to the Ollama server address with the /v1 path, for example the host and port you confirmed followed by /v1. Most OpenAI SDKs read this value from a setting such as the base URL parameter or an environment variable, so check the SDK version your application uses. Do not change the endpoint paths in the application code. The client should send chat and model requests to the same host and port you tested in the first two steps.
Set a placeholder API key
Local calls to Ollama do not require authentication, but most OpenAI SDKs refuse to start without a key value. Set a non-empty placeholder, such as the word local or a similar value, so the client initializes. Do not reuse a real OpenAI key here, because a stray key could be sent to the wrong service if the base URL is misconfigured. Direct calls to Ollama's cloud endpoints are a different case and require a real key sent as a Bearer token, so confirm that your application only uses this placeholder against your own server.
Pull the model and confirm its name
On the Ollama server, pull the model the application will request, then list the installed models. The name in the list is the exact string the client must send in the model field, including any tag after the colon. Confirm the model is stored in the directory you planned, which the OLLAMA_MODELS variable controls when it is set. A model that appears in the list is ready for requests; a model missing from the list will return an error on the first call, so resolve it before the test.
Send a test request and check the response
Send a minimal chat completion from the application's own client code, using the base URL, placeholder key and model name from the previous steps. A successful response contains a choices list with generated content, and the server log records the request. Run the same test against the endpoint your application uses for other calls, such as model listing, so each path your code relies on is covered. Keep the test script and its output, since it becomes the baseline for the compatibility checks that follow.
Configuration options and when each fits
This table compares the base URL targets, model naming, bind address and cloud switch that decide where an OpenAI client sends its requests. Read each row for the fit, the main risk and the setting to confirm before pointing a production application at the server.
| Option | Best fit | Main risk | Setting to confirm |
|---|---|---|---|
| Localhost base URL | Developer tests on the same machine as Ollama, using as the base URL | Works only for clients on that host, and the API has no authentication, so it must not be exposed casually | Confirm the server answers on 127.0.0.1 port 11434 with the client configured to that address |
| Shared server behind a proxy | Several applications on the internal network calling one Ollama server through a reverse proxy such as Nginx | The proxy becomes the only control point for access, so a missing authentication layer leaves the model open to the network | Confirm OLLAMA_HOST, the proxy listener, and that authentication is enforced before traffic reaches port 11434 |
| Direct ollama.com/v1 cloud inference | Applications that need hosted cloud models and accept a third party processing their prompts | Prompts leave your infrastructure, and the API key becomes a credential that must be stored and rotated | Confirm the Bearer API key is held in a secret store and that your data rules allow cloud processing |
| Model name matching | Passing the exact local model tag, such as the name shown by the local model list, in the model field | Clients with hardcoded OpenAI model names fail or silently use a different model | Confirm each model tag with the server's model list before testing the application |
| OLLAMA_HOST bind address | Changing the listen address so a proxy or internal interface can reach the server | Setting a non-loopback address exposes the unauthenticated API to every host that can route to it | Confirm the bind address, firewall rules and that no public interface is included |
| OLLAMA_NO_CLOUD=1 | Restricted or regulated networks where cloud features must be disabled on the server | Cloud model names fail with errors if applications still reference them | Confirm the variable or server configuration file setting and test that cloud model calls are refused |
How an OpenAI client request reaches Ollama
The request starts in an application that uses an OpenAI SDK with its base URL pointed at the Ollama host. By default Ollama listens only on 127.0.0.1 port 11434, so a client on another machine needs a changed bind address or a reverse proxy that adds authentication. The server reads models from its local model store. Check that the trust boundary sits where you intend, and that no request leaves the host unless you configured cloud inference.
Request path from an OpenAI SDK client to a self-hosted Ollama server.
Which endpoints and fields work, and which options are unsupported
Ollama serves an OpenAI-compatible surface alongside its native REST API on port 11434, and both live on the same server. The compatibility list is documented in the Ollama project and changes between releases, so confirm the current endpoint list in the Ollama GitHub repository before you configure a client. Treat any endpoint that is not on that list as unavailable until a test proves otherwise.
- Chat completions: the route most chat clients call, usually a path under
/v1such as/v1/chat/completions. Confirm the exact path and streaming behavior in the current docs. - Model listing: clients that check available models call a models route. Confirm it returns the exact tags you have pulled to the server.
- Embeddings: confirm whether an embeddings route is exposed for the embedding models you plan to use, since embedding and chat models are configured differently.
- Native API: Ollama's native endpoints remain on the same server for tooling that needs Ollama-specific behavior, so keep those routes separate in your application configuration.
Check each endpoint your application actually calls against a running server, not only against the documentation list.
Most applications send a small set of request fields on every call. These usually map cleanly, but the mapping is the part an OpenAI client will not warn you about, so verify each field your code uses against the current compatibility notes. Confirm how Ollama applies each value, including defaults that differ from the hosted service you used before.
- model: the value must match a model tag already present on the server, including the tag suffix. A name that works locally may fail on a second server that has a different set of pulled models.
- messages: confirm that every role your application uses, such as system, user, assistant and tool, is accepted and handled in the order you expect.
- stream: confirm that streamed chunks follow the format your client parser expects, including the final chunk.
- Sampling and length fields: temperature, top_p, seed, stop sequences and the output token limit are common in application code. Confirm the name mapping for each one, because a field that is accepted may still not match the behavior you assumed.
Record which fields your application reads from the response, such as content, finish reason and usage, and confirm each one appears in the returned object.
Some options that OpenAI clients send by default are not supported on the Ollama side. The compatibility list in the current documentation is the authority for each one, so confirm its status before release. The two options most often named as unsupported are logprobs and tool_choice, and applications that rely on either need a deliberate plan.
- logprobs: applications that use token probabilities for scoring, confidence display or ranking will lose that data or fail. Decide whether the feature is removed, computed another way or blocked for self-hosted deployments.
- tool_choice: applications that force a particular tool call depend on this field. Confirm how the server handles tool calling at all, and whether the model you chose supports tools, before you rely on forced selection.
- Hosted-service features: features tied to a hosted provider, such as file upload or stored responses, may have no local equivalent. Confirm each one your application calls.
- Unknown parameters: SDK defaults can add fields you never wrote. Log the request body in a test environment to see what is actually sent.
For each unsupported option, test whether the server ignores it silently or returns an error, because that determines whether your application fails loudly or returns wrong results.
A compatibility list cannot tell you how your application behaves under your traffic and models. Build a test plan that exercises the fields and behaviors your application depends on, and run it against the same Ollama version and model tags you intend to deploy. Document the results so that a later upgrade can be compared against them.
- Streaming: check partial output, the final chunk and how the client handles an interrupted stream.
- Tool calls: test whether the model returns tool calls in the structure your client expects, including cases where the model makes no call.
- Errors and status codes: trigger invalid model names, oversized inputs and malformed requests, then confirm the error body and status code match what your retry logic handles.
- Usage and concurrency: Ollama's default is one parallel request per model (OLLAMA_NUM_PARALLEL), so run concurrent requests to see queueing and timeouts before users do.
- Version pinning: Ollama ships frequent releases, such as v0.40.5 released on 14 October 2026, so record the exact version tested.
Rerun this plan after every Ollama upgrade and after every change to model tags, because compatibility behavior can change without any change to your application code.
Questions teams ask before switching an application to Ollama
Does running Ollama cost money for our applications?
Running models on your own hardware is free of usage limits according to Ollama's pricing page, which states that self-hosted models are always unlimited. Paid plans apply to cloud models: Pro at $20 per month ($200 per year), Max at $100 per month, Team at $500 per month and Enterprise at custom pricing. Your real costs are the servers, GPUs, storage, power and the staff time to operate them. Check the Ollama pricing page for current terms before you budget, since plans can change.
How long does it take to switch an application to Ollama?
The switch is usually small in code because Ollama exposes OpenAI-compatible endpoints, so the main change is the base URL and model name. The effort grows with the number of applications, the features they use, and how much testing your quality and security teams require. Tool calling, streaming, structured output and any use of logprobs or tool_choice need checking against the models you plan to run. Ask any partner to break the timeline into discovery, switch, test and rollout phases, and to name what each phase depends on.
What does the team need to provide for the switch?
You need an inventory of the applications that call the OpenAI SDK, the endpoints and parameters each one uses, and the models they expect. You also need a test set of representative prompts with expected behavior, a reachable Ollama server in your network, and an owner who can approve changes. Engineers should know which options Ollama does not support, such as logprobs and tool_choice, so they can plan workarounds. Access to staging environments and a rollback plan are also required before production traffic moves.
Can our own engineers do the switch without a partner?
Yes, a team with backend experience and access to the applications can often change the base URL, map model names and run its own tests. Most of the risk sits in behavior differences, not syntax, so the work moves from coding to verification. A partner adds value when many applications share the server, when compliance evidence is needed, or when staff time is limited. Decide based on your team's capacity, the number of applications, and whether you need documented test results for reviewers.
What does Ollama Enterprise add that matters for applications?
Ollama's Enterprise plan adds model access controls, cost budgets per user or API key, a dedicated support channel and custom security options on top of the Team plan's features, according to the pricing page. These matter when many applications or teams share cloud models and you need spend limits per key. If you run only local models on your own hardware, these cloud-oriented controls may not apply to you. Ask your vendor which features cover your deployment model before you compare plans.
What should we ask a partner for in a quote?
Ask for a written scope listing the applications, endpoints, models and test cases covered. Request the deliverables, such as configuration changes, a test report, updated runbooks and a rollback procedure. Confirm who performs the work, what access they need, what you must provide, and how changes after go-live are handled. DeployOpen works from a written scope with agreed deliverables and timelines, and it does not publish a price list, so the quote follows from that scope. Also ask whether ongoing support or retesting is priced separately.
How do model size and traffic change the switch effort?
Larger models and higher request volume raise the work in capacity planning, concurrency settings and testing under load. Ollama's defaults allow one parallel request per model (OLLAMA_NUM_PARALLEL), and queued requests are capped at 512 by default (OLLAMA_MAX_QUEUE), so applications with bursts need load tests before launch. Multiple models on one server need planning for OLLAMA_MAX_LOADED_MODELS. Confirm these values with your own hardware and traffic profile, since a single application with light use is much simpler than a shared platform.
Will the switch send our prompts outside our network?
Ollama states that when it runs locally it does not see your prompts or data, and cloud features can be turned off with OLLAMA_NO_CLOUD=1 or the server configuration file. The local API at localhost:11434 has no authentication, so it must stay on a trusted network or sit behind an access layer. Direct cloud inference requires an API key sent as a Bearer token, so keep those keys out of application code. Verify these settings in your own environment and record them for your security reviewers.
Securing an OpenAI-compatible endpoint that has no built-in authentication
Ollama's OpenAI-compatible endpoint accepts requests without credentials on the local interface, so every card here concerns what changes once the server is reachable by other clients. Each card names one control to decide on and one check to run before any application points at a shared server.
Network exposure when OLLAMA_HOST changes
Ollama binds to 127.0.0.1 on port 11434 by default. Setting OLLAMA_HOST to a LAN or public address makes the unauthenticated API reachable by anyone who can route to that interface. Before changing it, confirm which interface the service listens on, restrict port 11434 at the host and network firewall, and test from a machine outside the allowed range. Keep the bind address on loopback whenever a proxy in front of it is the only intended client.
Adding authentication in front of the API
Because the local API does not check credentials, the usual pattern is a reverse proxy such as Nginx that terminates TLS, validates a token or SSO session, and forwards only the paths your applications need. Keep Ollama on loopback so the proxy is the only route in. Test that unauthenticated requests to /v1/chat/completions return an error at the proxy and that the proxy does not pass through admin or model management paths you have not reviewed.
Browser origins and cross-site requests
Browser-based tools can send requests to a local or internal Ollama address if the origin is allowed. A proxy-based design lets you restrict which origins may call the endpoint and reject unexpected preflight requests. Confirm the allowed origins your Ollama version applies, list every front-end that calls the API, and test a request from an unlisted web page to verify it is refused.
Cloud features and OLLAMA_NO_CLOUD
Cloud models run through ollama.com with an API key, so a server that is meant to stay local can still send requests off-premises if an application selects a cloud model name. Set OLLAMA_NO_CLOUD=1 or the equivalent entry in the server configuration file, then confirm that a cloud model name is refused. Record the setting in your deployment configuration so it survives service restarts and upgrades.
Data handling on local runs
Ollama states that when it runs locally it does not see your prompts or data. That statement covers the local runtime, not the proxy, logs or applications around it. Decide where prompt and response logging happens, who can read those logs, and how long they are kept. Confirm with your security team whether the proxy access logs record request bodies, because a proxy can capture prompts even when Ollama does not.
API key handling for cloud calls
Direct calls to ollama.com/api and ollama.com/v1 require an API key sent as a Bearer token. Store the key in your secrets manager, not in application code or shared environment files, and give each application its own key so it can be rotated or revoked alone. Keep the key out of the local proxy configuration. Ask Ollama which key scopes and rotation options apply to your account before you issue keys.
API authentication docsPatching across frequent releases
Ollama ships frequent releases. v0.40.5 was released on 14 October 2026, and v0.40.6 followed as a pre-release on 16 October 2026. Track the release feed, test each version in a staging copy of the proxy and client applications, and pin the version in production until the change is reviewed. Confirm that your OpenAI-compatible request and response shapes still pass your test suite after each upgrade.
Ollama GitHub releasesTesting an application before switching traffic to Ollama
Before you point production traffic at Ollama, build a written test plan that starts with an inventory of everything the application calls. List each endpoint the client uses, each request field it sends (for example model, messages, stream, temperature, max_tokens, tools and response_format), and each response field the code reads, including error handling for timeouts and non-200 responses. The inventory is the document your team checks the test results against. Any item that is not on it will surprise you later. Confirm against the current Ollama OpenAI compatibility documentation which endpoints and fields are supported, and mark any the application depends on that are partial or missing, such as logprobs or tool_choice, as blockers or as code changes to make first.
Run the same requests through a staging Ollama server and the current production path in parallel, using the same prompts and a fixed sample of real traffic that has been scrubbed of personal data. Compare more than the text of the answers. Check the structure of responses, streaming chunk behavior, finish reasons, token usage fields, how the application handles a model name that does not exist on the server, and what happens when a request exceeds the context length. Agree in advance who signs off on differences in wording, because model output will not match the hosted model. Record each difference and whether it is acceptable.
Load test the staging server at the concurrency you expect in production, then review the server settings that decide how it behaves under pressure. The relevant controls are OLLAMA_NUM_PARALLEL (the default is 1 parallel request per model), OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE (the default is 512 queued requests). Confirm what the application does when requests queue or time out, and whether retries multiply the load. Define a rollback path before the switch: keep the previous endpoint and API key configured, make the base URL a runtime setting rather than a code change, document who can flip it and how you confirm the change, and set a rule for when to revert based on error rates and latency you observe in staging. Confirm these thresholds with your application owner before the cutover.
Limits to confirm in your environment before go-live
The OpenAI-compatible endpoint lets existing clients run against Ollama with little change, but compatibility is partial. The cards below cover the gaps most likely to surface after go-live: fields that are ignored or rejected, model behavior, queue capacity, release drift and the licenses attached to each model.
Unsupported fields per client library
Each OpenAI client library sends its own default set of parameters, and some of them, such as logprobs and tool_choice, are not supported by Ollama's compatibility layer. Check the exact request fields your application and its SDK version send, not just the endpoint path. Run every code path that uses structured output, tool calls or streaming against the Ollama base URL, and record which fields are rejected or silently ignored. A field that is ignored can change application behavior without raising an error, so test outputs as well as status codes.
Ollama FAQModel behavior differences from hosted models
A model served by Ollama is not the same as a hosted OpenAI model, even when the request format matches. Output style, tool-call reliability, refusal patterns, context handling and JSON adherence vary by model and quantization. Build an evaluation set from your real prompts and compare pass rates on the exact model tag you plan to deploy, because prompts tuned for one model often need changes for another.
Concurrency and queue limits
Ollama's concurrency is governed by server settings, not by the client. The parallel request count, the number of models held in memory and the queue depth each have defaults that may suit a developer laptop but not a shared service. Confirm the values with OLLAMA_NUM_PARALLEL, OLLAMA_MAX_LOADED_MODELS and OLLAMA_MAX_QUEUE under peak load, and decide what your application does when requests wait or fail.
- Default queued requests
- 512
Release-to-release compatibility changes
Ollama ships frequent releases, and compatibility behavior can change between them. Pin the server version your tests passed against, read release notes before upgrading, and rerun your compatibility suite on a staging server before each change. Treat pre-releases as test targets only, since they may change without notice.
Ollama releasesLicenses for the model weights in use
The MIT license covers the Ollama runtime, but each model's weights carry their own license, which may restrict commercial use, redistribution, attribution or use in certain products. Record the license for every model tag the application calls, including fine-tuned or imported weights, and have legal review any terms that limit use. Confirm the terms with the model publisher, since a license can change between versions.
Keeping the compatibility layer current across Ollama releases
Ollama ships releases often, and each one can change how its OpenAI-compatible endpoints behave. The researched facts show v0.40.5 released on 14 October 2026 and v0.40.6 published as a pre-release on 16 October 2026, two releases within two days. A change to request parsing, response fields, streaming or defaults can break an application that worked the week before, and nothing in your client code will signal the difference. Treat the Ollama version as a dependency you pin, not a value that floats with the latest install.
Pin a specific version on every server that serves your applications, and record it next to the application release it was tested with. Do not run pre-releases such as v0.40.6 against shared services. Before any upgrade, re-run your compatibility test suite against a staging server on the candidate version, covering the endpoints, fields and streaming behavior your applications use, plus the model names you rely on. Confirm the results against the same unsupported-field checks you ran at launch, since a release can change how an ignored field is handled. Read the Ollama GitHub releases page for each version's changes before you schedule the upgrade.
Plan the upgrade as a change with a rollback. Keep the previous version binary or container image available so you can revert the server quickly, and make sure a failed test run blocks promotion. Ask your platform team to confirm where the pinned version is set, how it is deployed to each environment and who approves a version change. Schedule regular reviews of the release notes even when you do not plan to upgrade, so a security fix or a changed default does not reach production unnoticed.
How DeployOpen scopes and delivers an OpenAI-compatible Ollama integration
DeployOpen treats an OpenAI-compatible Ollama integration as a scoped piece of work on your own infrastructure. We inventory the applications that call the API, agree the endpoints and fields they need, build and test the client configuration, and hand over documentation your team can run. Engagements are fixed-scope, with the deliverables agreed in writing before work starts.
How we scope
- We list every application and script that will point at the OpenAI-compatible endpoints and record the calls each one makes.
- We confirm which endpoints and request fields each client uses, and flag any unsupported option such as logprobs or tool_choice before build starts.
- The written scope fixes the applications covered, the test cases, the deliverables and the timeline, and it is agreed before work begins.
How we build
- We configure the base URL, model names and API key handling in each client, keeping the local server and any proxy settings in your environment.
- We run a test suite against your Ollama server that covers chat, streaming, embeddings and error handling for each application.
- We compare responses from the current OpenAI client and the Ollama target so behavior differences are documented, not assumed.
How we hand over
- You receive the configuration files, environment variable settings, model list and a record of the test results for each application.
- The handover document lists known gaps, unsupported fields and the workarounds agreed for each one.
- We walk your engineers through the setup and the cutover checklist so the team can repeat the tests after changes.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, so client behavior can be rechecked after Ollama version changes.
- We can retest applications when models, Ollama releases or your proxy configuration change, and update the documentation to match.
- Support scope, response expectations and fees are set in the retainer agreement and quoted from the written scope.

