{"id":25412804,"url":"https://github.com/nyirocsaba/thinkollama","last_synced_at":"2026-04-29T00:32:53.890Z","repository":{"id":277823741,"uuid":"933328579","full_name":"nyirocsaba/thinkollama","owner":"nyirocsaba","description":"ThinkOllama is a proxy for Ollama that adds reasoning capability to installed models.","archived":false,"fork":false,"pushed_at":"2025-02-16T20:03:19.000Z","size":261,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-16T01:50:48.277Z","etag":null,"topics":["api","chain-of-thought","deepseek-r1","llm","ollama","ollama-api","openwebui","python","reasoning"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nyirocsaba.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-15T17:38:11.000Z","updated_at":"2025-02-16T19:58:06.000Z","dependencies_parsed_at":"2025-02-16T12:18:26.228Z","dependency_job_id":"73eb2eeb-14a2-4226-95e4-8b0e99ae1b43","html_url":"https://github.com/nyirocsaba/thinkollama","commit_stats":null,"previous_names":["nyirocsaba/thinkollama"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nyirocsaba/thinkollama","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyirocsaba%2Fthinkollama","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyirocsaba%2Fthinkollama/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyirocsaba%2Fthinkollama/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyirocsaba%2Fthinkollama/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nyirocsaba","download_url":"https://codeload.github.com/nyirocsaba/thinkollama/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nyirocsaba%2Fthinkollama/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32405901,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","chain-of-thought","deepseek-r1","llm","ollama","ollama-api","openwebui","python","reasoning"],"created_at":"2025-02-16T13:27:58.848Z","updated_at":"2026-04-29T00:32:53.873Z","avatar_url":"https://github.com/nyirocsaba.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ThinkOllama\n\nThinkOllama is a proxy for Ollama that adds reasoning capability to installed models.\n\nIt uses DeepSeek R1 (via Ollama) to generate reasoning and appends it to user queries before forwarding them to the target model.\n\nIntegrates as an Ollama service into OpenWebUI. \nBy prefixing the available models installed in Ollama in order to distinguish between the standard Ollama models and the CoT-augmented versions, resolving model naming conflicts.\n\n### Example: 9.11 vs 9.9 Decision\n\n![phi4 vs thinkphi4](docs/images/example-phi4-vs-thinkphi4-9.11gt9.9.png)\n\n## Features\n\n- **Ollama-Based DeepSeek R1 Integration:** Utilizes Ollama to run DeepSeek R1 for internal CoT generation and extraction.\n- **Chain-of-Thought Extraction:** Extracts reasoning from DeepSeek responses and uses it to enhance other models response generation.\n- **Model Prefixing for OpenWebUI Integration:** Prefixes available models to integrate both standard Ollama models and CoT-augmented versions, avoiding naming conflicts.\n- **Configurable Ollama Endpoint in OpenWebUI:** Allows users to manually configure the Ollama API Base URL in OpenWebUI under **Admin Settings \u003e Connections \u003e Ollama** to connect with ThinkOllama.\n- **API Endpoints:**\n  - `POST /api/chat` — Processes chat messages, extracts CoT via DeepSeek through Ollama, and primes the model before returning responses.\n  - `GET /api/tags` — Proxies requests to fetch available model tags from Ollama.\n  - `GET /api/version` — Proxies requests to fetch the current version from Ollama.\n\n\n## Running with Docker\n\nTo run **ThinkOllama** and **Ollama** in separate containers:\n\n1. **Start the Ollama container (if you do not have ollama deployed already):**\n\n   ```bash\n   docker run -d \\\n     --name ollama \\\n     -v ollama:/root/.ollama \\\n     -p 11434:11434 \\\n     ollama/ollama\n   ```\n\n2. **Start ThinkOllama with Docker:**\n\n   ```bash\n    docker run -d \\\n        --name thinkollama \\\n        --add-host=host.docker.internal:host-gateway \\\n        -p 11435:11435 \\\n        -e OLLAMA_URL=http://host.docker.internal:11434 \\\n        -e DEEPSEEK_URL=http://host.docker.internal:11434 \\\n        -e DEEPSEEK_MODEL=deepseek-r1:14b \\\n        -e MODELS_PREFIX=think: \\\n        nyirocsaba/thinkollama:latest\n   ```\n\n3. **Verify connectivity:**\n\n   ```bash\n   curl http://127.0.0.1:11435/api/tags\n   ```\n\nIf this returns a list of models, ThinkOllama is successfully communicating with Ollama!\n\n## Manual Installation (For Non-Docker Users)\n\n1. **Clone the repository:**\n\n   ```bash\n   git clone https://github.com/nyirocsaba/thinkollama.git\n   cd thinkollama\n   ```\n\n2. **Install dependencies:**\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n## Configuration\n\nCreate a `.env` file in the repository root (you can start by copying the provided `.env.example`):\n\n```bash\ncp .env.example .env\n```\n\nEnsure your `.env` contains the necessary variables:\n\n```\nDEEPSEEK_URL=http://localhost:11434\nOLLAMA_URL=http://localhost:11434\nDEEPSEEK_MODEL=deepseek-r1:14b\nMODELS_PREFIX=think:\n```\n\n## Running the Application\n\nStart the FastAPI server using Uvicorn:\n\n```bash\nuvicorn src.thinkollama:app --host 127.0.0.1 --port 11435\n```\n\n## OpenWebUI Integration\n\nTo configure OpenWebUI to use ThinkOllama as its Ollama backend:\n\n1. **Open OpenWebUI.**\n2. Navigate to **Admin Settings \u003e Connections \u003e Ollama API**.\n3. Add a new connection and set the **Ollama API Base URL** to `http://127.0.0.1:11435` (or the appropriate ThinkOllama address).\n![Ollama and ThinkOllama API Connections in OpenWebUI](docs/images/openwebui-connections.png)\n4. Save changes to apply the new configuration.\n5. Check models list, you should have all the installed ollama models and all of them with think: (or your prefix set in .env) to query Ollama models through ThinkOllama.\n\n![Ollama and ThinkOllama models in OpenWebUI](docs/images/openwebui-ollama-thinkollama-models.png)\n\n### **Recommended OpenWebUI Settings**\n\nFor better performance and usability, we recommend changing the following setting in OpenWebUI:\n\n- **Settings \u003e Interface \u003e Local Models**: Set this to **Direct Ollama Model** instead of **Current Model**. This ensures that CoT-augmented variants are not used for title and tag generations, as they consume more resources and may not be optimal for these tasks.\n\n## API Usage\n\n- **Chat Completion Endpoint**\n  - **URL:** `/api/chat`\n  - **Method:** `POST`\n  - **Payload Example:**\n\n    ```json\n    {\n      \"model\": \"think:your-model-name\",\n      \"messages\": [\n        {\"role\": \"user\", \"content\": \"Your chat query here\"}\n      ],\n      \"stream\": true\n    }\n    ```\n\n- **Tags Endpoint**\n  - **URL:** `/api/tags`\n  - **Method:** `GET`\n\n- **Version Endpoint**\n  - **URL:** `/api/version`\n  - **Method:** `GET`\n\n## Contributing\n\nContributions are welcome! Please feel free to open issues or submit pull requests.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyirocsaba%2Fthinkollama","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnyirocsaba%2Fthinkollama","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnyirocsaba%2Fthinkollama/lists"}