Oai2Ollama
This is a CLI tool that starts a server that wraps an OpenAI-compatible API and expose an Ollama-compatible API, which is useful for providing custom models for coding agents that don't support custom OpenAI APIs but do support Ollama (like GitHub Copilot for VS Code).
Usage
with Python
You can run directly via uvx (if you have uv installed) or pipx:
uvx oai2ollama --help
usage: oai2ollama [--api-key str] [--base-url HttpUrl] [--capabilities list[str]] [--models list[str]] [--host str]
options:
--help, -h Show this help message and exit
--api-key str API key for authentication (required)
--base-url HttpUrl Base URL for the OpenAI-compatible API (required)
--capabilities, -c list[str] Extra capabilities to mark the model as supporting
--models, -m list[str] Extra models to include in the /api/tags response
--host str IP / hostname for the API server (default: localhost)
To mark the model as supporting certain capabilities, you can use the
--capabilities(or-c) option with a list of strings. For example, the following two syntaxes are supported:
oai2ollama -c toolsoroai2ollama --capabilities tools
oai2ollama -c tools -c visionoroai2ollama --capabilities -c tools,visionTo support models that are not returned by the
/modelsendpoint, use the--models(or-m) option to add them to the/api/tagsresponse:
oai2ollama -m model1 -m model2oroai2ollama -m model1,model2Capabilities currently used by Ollama are:
tools,insert,vision,embedding,thinkingandcompletion. We always includecompletion.
Or you can use a .env file to set these options:
OPENAI_API_KEY=your_api_key
OPENAI_BASE_URL=your_base_url
HOST=0.0.0.0
CAPABILITIES=["vision","thinking"]
MODELS=["custom-model1","custom-model2"]
The option name
capacitiesis deprecated. Usecapabilitiesinstead. The old name still works for now but will emit a deprecation warning.
with Docker
First, build the image:
docker build -t oai2ollama .
Then, run the container with your credentials:
docker run -p 11434:11434 \
-e OPENAI_API_KEY="your_api_key" \
-e OPENAI_BASE_URL="your_base_url" \
oai2ollama
Or you can pass these as command line arguments:
docker run -p 11434:11434 oai2ollama --api-key your_api_key --base-url your_base_url
To have the server listen on a different host, like all IPv6 interfaces, use the --host argument:
docker run -p 11434:11434 oai2ollama --host "::"
Metadata
Release files for oai2ollama 1.2.8.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| oai2ollama-1.2.8.4.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| oai2ollama-1.2.8.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / oai2ollama-1.2.8.4.tar.gz
| Download URL | oai2ollama-1.2.8.4.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
045b4dabe403e6bb8731b78adf301d929bf49d6c63684152ac938affca9e66b4
|
|
BLAKE2b-256 checksum How to use checksums |
cd739fcb79705961afbd2677b27d05977c71d7a5ca73f64fbd4ee440dd56f2f9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.
Transparency logRelease files / oai2ollama-1.2.8.4-py3-none-any.whl
| Download URL | oai2ollama-1.2.8.4-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40f316222208847246f30dfc9fe8710f0feab171ed7d73dbd3e1897610e56db5
|
|
BLAKE2b-256 checksum How to use checksums |
253bceca5b758584934ea9f6d9f4e17b98a129cc08295fe72b9e58212f2f4076
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 30, 2026.
Transparency log