{"id":18076034,"url":"https://github.com/rabilrbl/deepseek-api","last_synced_at":"2025-04-12T08:11:38.204Z","repository":{"id":206474336,"uuid":"716728395","full_name":"rabilrbl/deepseek-api","owner":"rabilrbl","description":"Unofficial API Wrapper for Deepseek (chat.deepseek.com)","archived":false,"fork":false,"pushed_at":"2024-01-05T17:04:21.000Z","size":103,"stargazers_count":57,"open_issues_count":4,"forks_count":13,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T03:21:48.567Z","etag":null,"topics":["deepseeek","deepseek-chat","deepseek-coder","deepseek-llm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rabilrbl.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}},"created_at":"2023-11-09T18:42:43.000Z","updated_at":"2025-03-19T15:55:17.000Z","dependencies_parsed_at":"2023-12-21T07:55:00.390Z","dependency_job_id":"5df271b1-5d43-4969-9fb2-2f4f0c6c4fc4","html_url":"https://github.com/rabilrbl/deepseek-api","commit_stats":null,"previous_names":["rabilrbl/deepseek-coder-api"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabilrbl%2Fdeepseek-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabilrbl%2Fdeepseek-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabilrbl%2Fdeepseek-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rabilrbl%2Fdeepseek-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rabilrbl","download_url":"https://codeload.github.com/rabilrbl/deepseek-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248537137,"owners_count":21120711,"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":["deepseeek","deepseek-chat","deepseek-coder","deepseek-llm"],"created_at":"2024-10-31T11:08:27.508Z","updated_at":"2025-04-12T08:11:38.175Z","avatar_url":"https://github.com/rabilrbl.png","language":"Python","readme":"# Deepseek coder Reverse Engineered API Wrapper\n\nUnofficial API Wrapper for Deepseek (chat.deepseek.com) in Python. This is a reverse-engineered API for the Deepseek coder and Deepseek code chatbots. This API is not affiliated with Deepseek in any way.\n\n## Installation\n\n```bash\npip install git+https://github.com/rabilrbl/deepseek-api.git\n```\n\n## Usage\n\n### Asynchronous CLI Example\n\n```python\nimport asyncio\nimport os\nfrom deepseek_api import DeepseekAPI\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\n\nasync def main():\n    email = os.environ.get(\"DEEPSEEK_EMAIL\")\n    password = os.environ.get(\"DEEPSEEK_PASSWORD\")\n\n    async with DeepseekAPI(\n        email=email,\n        password=password,\n        save_login=True,  # save login credentials to login.json\n        model_class=\"deepseek_code\",  # Choose from \"deepseek_chat\" or \"deepseek_code\"\n    ) as app:\n        print(\n            \"\"\"\n            Usage:\n                - Type 'new' to start a new chat.\n                - Type 'exit' to exit.\n                \n            Start chatting!\n        \"\"\"\n        )\n\n        while True:\n            message = input(\"\u003e \")\n\n            if message == \"exit\":\n                break\n            elif message == \"new\":\n                await app.new_chat()\n                continue\n\n            async for chunk in app.chat(message):\n                try:\n                    # keep printing in one line\n                    print(chunk[\"choices\"][0][\"delta\"][\"content\"], end=\"\")\n                except KeyError as ke:\n                    print(ke)\n            print()\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\n### Synchonous CLI Example\n\n```python\nimport os\nfrom deepseek_api import SyncDeepseekAPI\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\n\ndef main():\n    email = os.environ.get(\"DEEPSEEK_EMAIL\")\n    password = os.environ.get(\"DEEPSEEK_PASSWORD\")\n\n    app = SyncDeepseekAPI(\n        email=email,\n        password=password,\n        save_login=True,  # save login credentials to login.json\n        model_class=\"deepseek_code\",  # Choose from \"deepseek_chat\" or \"deepseek_code\"\n    )\n\n    print(\n        \"\"\"\n          Usage:\n            - Type 'new' to start a new chat.\n            - Type 'exit' to exit.\n            \n          Start chatting!\n    \"\"\"\n    )\n\n    while True:\n        message = input(\"\u003e \")\n\n        if message == \"exit\":\n            # close the app\n            app.close()\n            break\n        elif message == \"new\":\n            app.new_chat()\n            continue\n\n        response = app.chat(message)\n\n        for chunk in response:\n            try:\n                # keep printing in one line\n                print(chunk[\"choices\"][0][\"delta\"][\"content\"], end=\"\")\n            except KeyError as ke:\n                print(ke)\n        print()\n\n\nif __name__ == \"__main__\":\n    main()\n```\n\n## License\n\n[CC BY-NC-SA 4.0](https://creativecommons.org/licenses/by-nc-sa/4.0/)\n\n## Disclaimer\n\nThis project is not affiliated with Deepseek in any way. Use at your own risk. This project was created for educational purposes only.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabilrbl%2Fdeepseek-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frabilrbl%2Fdeepseek-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frabilrbl%2Fdeepseek-api/lists"}