{"id":24559154,"url":"https://github.com/vhanla/deepseek-r1-unthink","last_synced_at":"2026-05-21T10:02:15.715Z","repository":{"id":273772753,"uuid":"920830837","full_name":"vhanla/deepseek-r1-unthink","owner":"vhanla","description":"Ollama's API proxy server that captures /api/chat responses and removes \u003cthink\u003e\u003c/think\u003e streamed content","archived":false,"fork":false,"pushed_at":"2025-01-22T21:27:51.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T22:19:31.274Z","etag":null,"topics":["deepseek","deepseek-r1","no-think","ollama","remove-think","think"],"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/vhanla.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}},"created_at":"2025-01-22T21:02:20.000Z","updated_at":"2025-01-22T21:27:54.000Z","dependencies_parsed_at":"2025-01-22T22:29:41.216Z","dependency_job_id":null,"html_url":"https://github.com/vhanla/deepseek-r1-unthink","commit_stats":null,"previous_names":["vhanla/deepseek-r1-unthink"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vhanla%2Fdeepseek-r1-unthink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vhanla%2Fdeepseek-r1-unthink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vhanla%2Fdeepseek-r1-unthink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vhanla%2Fdeepseek-r1-unthink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vhanla","download_url":"https://codeload.github.com/vhanla/deepseek-r1-unthink/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243922290,"owners_count":20369377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deepseek","deepseek-r1","no-think","ollama","remove-think","think"],"created_at":"2025-01-23T06:15:00.032Z","updated_at":"2026-05-21T10:02:15.709Z","avatar_url":"https://github.com/vhanla.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# deepseek-r1-unthink\n\n  Ollama's API proxy server that captures `/api/chat` and `/api/generate` responses and \n    removes \u003cthink\u003e\u003c/think\u003e streamed content, so we get rid of \n    the \"\u0026lt;THINK\u0026gt;-ing process\" specially on DeepSeek-R1's generated content.\n| e.g. |\n|:--:|\n| ![imagen](https://github.com/user-attachments/assets/bf18ba19-a63f-40ba-aa07-0f8aa8a87009) |\n|    Zed's settings.json demo in action, notice it doesn't show the \u0026lt;think\u0026gt;\u0026lt;/think\u0026gt; content anymore. |\n\n\n# Ollama Proxy Server\nA Flask-based proxy server for Ollama that provides enhanced streaming capabilities and thinking tag handling. This proxy sits between your client application and the Ollama server, filtering and processing the response stream.\n\n## Features\n\n- Proxies requests to Ollama server\n- Handles streaming responses efficiently\n- Processes special thinking tags (\u003cthink\u003e and \u003c/think\u003e) to filter internal processing\n- Maintains CORS support for cross-origin requests\n- Supports both chat and generate endpoints\n- Cleans up response formatting and removes excessive newlines\n\n## Prerequisites\n\n- Python 3.7+\n- Ollama server running locally or remotely\n- pip (Python package manager)\n\n## Installation\n\n1. Clone this repository:\n```bash\ngit clone https://github.com/yourusername/ollama-proxy.git\ncd ollama-proxy\n``` \n3. Install required dependencies:\n```bash\npip install flask flask-cors requests\n```\n## Configuration\n\nThe proxy server uses two main configuration variables at the top of the script:\n\n```python\nOLLAMA_SERVER = \"http://localhost:11434\"  # Your Ollama server address\nPROXY_PORT = 11435                        # Port for this proxy server\n```\nModify these values in the code to match your setup if needed.\n## Usage\n\n1. Start the proxy server:\n```python\npython app.py\n```\n2. The server will start on port 11435 (default) and forward requests to your Ollama server\n3. Use the proxy in your applications by pointing them to:\n```\nhttp://localhost:11435\n```\n## API Endpoints\n\nThe proxy server supports the following Ollama endpoints:\n\n- /api/generate - For text generation\n- /api/chat - For chat interactions\n\nAll other Ollama endpoints are proxied as-is.\n\n## Thinking Tag Processing\n\nThe proxy server handles special thinking tags in the response stream:\n\n- Content between \u003cthink\u003e and \u003c/think\u003e tags is filtered out\n- Content before \u003cthink\u003e and after \u003c/think\u003e is preserved\n- Handles cases where tags may appear in any order or be unpaired\n\n**Example:**\n\n```\nInput stream: \"Hello \u003cthink\u003eprocessing request\u003c/think\u003e World!\"\nOutput stream: \"Hello World!\"\n```\n\n## CORS Support\nThe server includes CORS support with the following configuration:\n\n- Allows all origins (*)\n- Supports GET, POST, and OPTIONS methods\n- Allows all headers\n\n## Error Handling\n\nInvalid JSON responses are forwarded as-is\nNon-content messages (like 'done' signals) are preserved\nMissing or malformed thinking tags are handled gracefully\nHTTP errors from Ollama are properly proxied\n\n## Development\nThe server includes debug mode by default when running directly. To modify this behavior, change the `debug` parameter in:\n\n```python\napp.run(port=PROXY_PORT, debug=True)\n```\n## License\nMIT Licence\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (git checkout -b feature/amazing-feature)\n3. Commit your changes (git commit -m 'Add some amazing feature')\n4. Push to the branch (git push origin feature/amazing-feature)\n5. Open a Pull Request\n\n## Support\nFor issues, questions, or contributions, please:\n\n1. Check existing GitHub issues\n2. Create a new issue if needed\n3. Provide as much context as possible\n\n## Acknowledgments\n\n- Ollama team for the base server\n- Contributors to Flask and related packages\n\n2025-09-19\nUpdated and tested with aider and qwen3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvhanla%2Fdeepseek-r1-unthink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvhanla%2Fdeepseek-r1-unthink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvhanla%2Fdeepseek-r1-unthink/lists"}