{"id":22683499,"url":"https://github.com/notedit/bailian2openai","last_synced_at":"2026-07-05T19:31:15.527Z","repository":{"id":260920131,"uuid":"882702526","full_name":"notedit/bailian2openai","owner":"notedit","description":"阿里百炼 to  openai 兼容","archived":false,"fork":false,"pushed_at":"2024-11-03T15:28:35.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T03:32:33.269Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/notedit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-11-03T14:39:28.000Z","updated_at":"2025-03-31T08:27:11.000Z","dependencies_parsed_at":"2024-11-03T16:26:07.460Z","dependency_job_id":null,"html_url":"https://github.com/notedit/bailian2openai","commit_stats":null,"previous_names":["notedit/bailian2openai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/notedit/bailian2openai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Fbailian2openai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Fbailian2openai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Fbailian2openai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Fbailian2openai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/notedit","download_url":"https://codeload.github.com/notedit/bailian2openai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/notedit%2Fbailian2openai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35167259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"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":[],"created_at":"2024-12-09T21:12:20.632Z","updated_at":"2026-07-05T19:31:15.490Z","avatar_url":"https://github.com/notedit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bailian2openai\n\n阿里百炼 API 转 OpenAI API 格式的适配服务，支持将 OpenAI 格式的请求转发到阿里百炼 API。\n\n## 功能特点\n\n- 支持 OpenAI chat completions API 格式\n- 支持多轮对话（通过 session_id）\n- 自动处理认证和格式转换\n- 兼容现有的 OpenAI 客户端代码\n\n## 安装\n\n1. 克隆仓库：\n\n   ```bash\n   git clone https://github.com/yourusername/bailian2openai.git\n   cd bailian2openai\n   ```\n\n2. 安装依赖：\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. 配置环境变量：\n\n   创建 `.env` 文件并添加以下配置：\n\n   ```plaintext\n   DASHSCOPE_API_KEY=your_api_key_here\n   DASHSCOPE_APP_ID=your_app_id_here\n   ```\n\n## 运行服务\n\n启动服务器：\n\n```bash\npython main.py\n```\n\n服务将在 `http://localhost:8000` 上运行。\n\n## API 使用\n\n### 发送聊天请求\n\n使用以下命令发送聊天请求：\n\n```bash\ncurl -X POST \"http://localhost:8000/chat/completions\" \\\n     -H \"Content-Type: application/json\" \\\n     -H \"X-Task-Id: your_task_id_here\" \\\n     -H \"X-Request-Id: your_request_id_here\" \\\n     -d '{\"messages\": [{\"role\": \"user\", \"content\": \"Hello, how are you?\"}]}'\n```\n\n\n\n## 环境变量说明\n\n- `DASHSCOPE_API_KEY`: 阿里百炼 API 密钥\n- `DASHSCOPE_APP_ID`: 阿里百炼应用 ID\n\n## 注意事项\n\n1. 请确保已获取阿里百炼的 API 密钥和应用 ID。\n2. 服务默认监听所有网络接口（0.0.0.0），如需更改请修改 `main.py`。\n3. 默认端口为 8000，可以通过修改 `main.py` 更改。\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotedit%2Fbailian2openai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnotedit%2Fbailian2openai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnotedit%2Fbailian2openai/lists"}