{"id":20113884,"url":"https://github.com/cherish-chat/chatgpt-server-python","last_synced_at":"2026-05-09T05:02:12.873Z","repository":{"id":142543906,"uuid":"608946270","full_name":"cherish-chat/chatgpt-server-python","owner":"cherish-chat","description":"python写的chatgpt grpc server  提供了golang的调用方式","archived":false,"fork":false,"pushed_at":"2023-03-09T05:43:26.000Z","size":70,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-02T18:51:26.633Z","etag":null,"topics":["chatgpt","golang","grpc"],"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/cherish-chat.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":"2023-03-03T03:30:35.000Z","updated_at":"2023-03-03T11:44:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"3e05aa94-360f-4f85-bb5d-964e31f347df","html_url":"https://github.com/cherish-chat/chatgpt-server-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cherish-chat/chatgpt-server-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherish-chat%2Fchatgpt-server-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherish-chat%2Fchatgpt-server-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherish-chat%2Fchatgpt-server-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherish-chat%2Fchatgpt-server-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cherish-chat","download_url":"https://codeload.github.com/cherish-chat/chatgpt-server-python/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cherish-chat%2Fchatgpt-server-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32807861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chatgpt","golang","grpc"],"created_at":"2024-11-13T18:26:54.316Z","updated_at":"2026-05-09T05:02:12.835Z","avatar_url":"https://github.com/cherish-chat.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# chatgpt-server-python\n\npython写的chatgpt grpc server\n\n## 环境变量\n\n```bash\nexport OPENAI_API_KEY=your_openai_api_key\nexport GRPC_SERVER_PORT=50051 # default=50051\n```\n\n## docker部署\n\n### 1. 编译二进制\n\n```bash\nrm -rf requirements.txt chatgpt-server-python.tar.gz\npip freeze \u003e requirements.txt\ntar -czvf chatgpt-server-python.tar.gz requirements.txt main.py pb/* server/* tool/*\n```\n\n### 2. 构建镜像\n\n```bash\ndocker build --platform linux/amd64  -t registry.cn-shanghai.aliyuncs.com/xxim-dev/chatgpt-server-python:202303071601 .\n```\n\n### 3. 运行容器\n\n```bash\ndocker run --name chatgpt-server-python \\\n-d -p 50051:50051 \\\n-e OPENAI_API_KEY=your_openai_api_key \\\nregistry.cn-shanghai.aliyuncs.com/xxim-dev/chatgpt-server-python:202303031900\n```\n\n## go sdk 调用示例\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\tchatgptpb \"github.com/cherish-chat/chatgpt-server-python/pb\"\n\t\"github.com/zeromicro/go-zero/zrpc\"\n\t\"log\"\n)\n\nfunc main() {\n\tconf := zrpc.RpcClientConf{\n\t\tEndpoints: []string{\"127.0.0.1:50051\"},\n\t\tNonBlock:  true,\n\t\tTimeout:   60000,\n\t}\n\tchatgptpb.InitClient(conf)\n\treply, err := chatgptpb.Answer(context.Background(), \u0026chatgptpb.AnswerReq{\n\t\tMessages: []*chatgptpb.ChatGptMessage{{\n\t\t\tText: \"我现在很无聊，我要一直复读你的话，请你不要生气\",\n\t\t\tRole: chatgptpb.RoleEnum_User,\n\t\t}},\n\t\tMaxTokens: 500,\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"error: %v\", err)\n\t} else {\n\t\tfor _, choice := range reply.Choices {\n\t\t\tlog.Printf(\"choice: %v\", choice.Message.Text)\n\t\t}\n\t}\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcherish-chat%2Fchatgpt-server-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcherish-chat%2Fchatgpt-server-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcherish-chat%2Fchatgpt-server-python/lists"}