{"id":14959672,"url":"https://github.com/rosemary666/chatgpt","last_synced_at":"2025-10-24T18:30:23.271Z","repository":{"id":152046913,"uuid":"621721999","full_name":"rosemary666/chatgpt","owner":"rosemary666","description":"chatgpt库的调用, 支持流式和非流式，可以实现类似官方chatgpt的显示效果","archived":false,"fork":false,"pushed_at":"2024-01-30T09:12:37.000Z","size":3345,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-28T13:44:46.467Z","etag":null,"topics":["chatapp","chatgpt","chatgpt-api","chatgpt-python","chatgpt-sdk","chatgpt3","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rosemary666.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}},"created_at":"2023-03-31T08:45:33.000Z","updated_at":"2024-06-03T02:01:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"2338a4a2-09aa-49ea-85c0-5992a7b5cf97","html_url":"https://github.com/rosemary666/chatgpt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosemary666%2Fchatgpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosemary666%2Fchatgpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosemary666%2Fchatgpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosemary666%2Fchatgpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosemary666","download_url":"https://codeload.github.com/rosemary666/chatgpt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219868210,"owners_count":16555876,"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":["chatapp","chatgpt","chatgpt-api","chatgpt-python","chatgpt-sdk","chatgpt3","python"],"created_at":"2024-09-24T13:20:34.372Z","updated_at":"2025-10-24T18:30:22.873Z","avatar_url":"https://github.com/rosemary666.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chatgpt\n\n![](https://img.shields.io/badge/language-python-blue.svg)\n[![Forks](https://img.shields.io/github/forks/rosemary666/chatgpt)](https://img.shields.io/github/forks/rosemary666/chatgpt)\n[![Stars](https://img.shields.io/github/stars/rosemary666/chatgpt)](https://img.shields.io/github/stars/rosemary666/chatgpt)\n[![Contributors](https://img.shields.io/github/contributors/rosemary666/chatgpt)](https://github.com/rosemary666/chatgpt/graphs/contributors)\n[![Docs](https://github.com/rosemary666/chatgpt/actions/workflows/deploy_doc.yaml/badge.svg)](https://github.com/rosemary666/chatgpt/actions/workflows/deploy_doc.yaml)\n[![Pypi](https://github.com/rosemary666/chatgpt/actions/workflows/publish_pypi.yaml/badge.svg)](https://github.comrosemary666/chatgpt/actions/workflows/publish_pypi.yaml)\n[![License: Apache2.0](https://img.shields.io/github/license/rosemary666/chatgpt)](https://github.com/rosemary666/chatgpt/blob/main/LICENSE)\n\n[DOCS](https://rosemary666.github.io/chatgpt/)\n\nchatgpt库的封装调用, 支持流式和非流式。\n\n## 特性\n- 支持流式和非流式\n- 支持底层调用chatgpt的封装(很easy启动)\n- 支持上层Http服务的封装调用(支持sse方式)\n\n## 调用\n\n### 安装\n```shell\npip install py-chatgpt-plus\n```\n\n### 底层调用 \n- 非流式\n\n```python\nfrom py_chatgpt_plus.core.chat_gpt_3 import ChatGptV3\n\ncg = ChatGptV3(\n    api_key=\"*****\",\n    system_prompt=\"请帮我把以下的工作内容填充为工作周报，用markdown格式以分点叙述的方式输出:\",\n)\nanswer = cg.chat_once(\"主要开展了三件事情, 第一是完成功能1的开发，第二是完成了xx的需求评审，第三是接待了xx客户\")\nprint(answer)\ncg.save_conversations(\"./conversations.json\")\n```\n\n- 流式\n\n```python\nfrom py_chatgpt_plus.core.chat_gpt_3 import ChatGptV3\n\ncg = ChatGptV3(\n    api_key=\"****\"  # 请填写自己生成的api_key\n)\n\nstreams = cg.chat_stream(prompt=\"**\")  # 返回的流式结果\nfor stream in streams:\n    print(stream)\n```\n\n### 上层调用\n上层支持以sse的接口形式将结果返回给调用方，采用该方式可模拟chatgpt官方网页显示效果。\n\n服务启动方式: \n```shell\n1. cd python/py_chatgpt_plus      \n2. 修改conf/service.yaml配置文件(重点配置api_key和proxy)      \n3. 执行run.sh即可启动   \n```\n     \n\n### 接口文档\n浏览器打开:\n```shell\nhttp://${ip}:${port}/api/v1/doc\n```\n即可在线访问(注意替换ip和port为真实启动的)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosemary666%2Fchatgpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosemary666%2Fchatgpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosemary666%2Fchatgpt/lists"}