Status: [UNTESTED] Endpoints found: http://127.0.0.1:8000/v1/models http://127.0.0.1:8000/chat/completions Source: https://github.com/Igsaeg/Ollama-CORS-Proxy # Ollama CORS Proxy A lightweight FastAPI proxy that exposes a local **Ollama** instance through an OpenAI-compatible API with **CORS support**. This makes locally hosted Ollama models accessible to browser-based applications and other services that support OpenAI-compatible APIs. ## Architecture ```text Client / Application │ │ HTTPS ▼ ngrok │ ▼ FastAPI Proxy :8000 │ │ HTTP ▼ Ollama :11434 │ ▼ Local LLM ``` ## Features * OpenAI-compatible `/chat/completions` endpoint * Ollama `/v1/chat/completions` forwarding * CORS support * `/models` and `/v1/models` endpoints * Streaming response support * Optional disabling of model thinking/reasoning * ngrok support for remote access * Hidden Windows launcher with startup confirmation ## Requirements * Windows 10/11 * Python 3.10+ * [Ollama](https://ollama.com/) * [ngrok](https://ngrok.com/) Verify Ollama is running: ```powershell ollama list ``` ## Installation Clone the repository: ```powershell git clone https://github.com/Igsaeg/ollama-cors-proxy.git cd ollama-cors-proxy ``` Create a virtual environment: ```powershell python -m venv .venv ``` Install dependencies: ```powershell .\.venv\Scripts\python.exe -m pip install fastapi uvicorn httpx ``` ## Running ### Manual Start the FastAPI proxy: ```powershell .\.venv\Scripts\python.exe -m uvicorn proxy:app --host 0.0.0.0 --port 8000 ``` In another terminal, expose the proxy through ngrok: ```powershell ngrok http 8000 ``` ngrok will provide a public HTTPS URL: ```text https://.ngrok-free.dev ``` ### Windows Launcher The project includes a `start.vbs` launcher that starts both Uvicorn and ngrok in the background without leaving terminal windows open. Before using it, set the project directory inside `start.vbs`: ```vbscript projectDir = "C:\path\to\your\project" ``` Then double-click: ```text start.vbs ``` The launcher: 1