[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-remsky--Kokoro-FastAPI":3,"tool-remsky--Kokoro-FastAPI":62},[4,18,26,36,46,54],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",160784,2,"2026-04-19T11:32:54",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":42,"last_commit_at":43,"category_tags":44,"status":17},8272,"opencode","anomalyco\u002Fopencode","OpenCode 是一款开源的 AI 编程助手（Coding Agent），旨在像一位智能搭档一样融入您的开发流程。它不仅仅是一个代码补全插件，而是一个能够理解项目上下文、自主规划任务并执行复杂编码操作的智能体。无论是生成全新功能、重构现有代码，还是排查难以定位的 Bug，OpenCode 都能通过自然语言交互高效完成，显著减少开发者在重复性劳动和上下文切换上的时间消耗。\n\n这款工具专为软件开发者、工程师及技术研究人员设计，特别适合希望利用大模型能力来提升编码效率、加速原型开发或处理遗留代码维护的专业人群。其核心亮点在于完全开源的架构，这意味着用户可以审查代码逻辑、自定义行为策略，甚至私有化部署以保障数据安全，彻底打破了传统闭源 AI 助手的“黑盒”限制。\n\n在技术体验上，OpenCode 提供了灵活的终端界面（Terminal UI）和正在测试中的桌面应用程序，支持 macOS、Windows 及 Linux 全平台。它兼容多种包管理工具，安装便捷，并能无缝集成到现有的开发环境中。无论您是追求极致控制权的资深极客，还是渴望提升产出的独立开发者，OpenCode 都提供了一个透明、可信",144296,1,"2026-04-16T14:50:03",[13,45],"插件",{"id":47,"name":48,"github_repo":49,"description_zh":50,"stars":51,"difficulty_score":32,"last_commit_at":52,"category_tags":53,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",109154,"2026-04-18T11:18:24",[14,15,13],{"id":55,"name":56,"github_repo":57,"description_zh":58,"stars":59,"difficulty_score":32,"last_commit_at":60,"category_tags":61,"status":17},6121,"gemini-cli","google-gemini\u002Fgemini-cli","gemini-cli 是一款由谷歌推出的开源 AI 命令行工具，它将强大的 Gemini 大模型能力直接集成到用户的终端环境中。对于习惯在命令行工作的开发者而言，它提供了一条从输入提示词到获取模型响应的最短路径，无需切换窗口即可享受智能辅助。\n\n这款工具主要解决了开发过程中频繁上下文切换的痛点，让用户能在熟悉的终端界面内直接完成代码理解、生成、调试以及自动化运维任务。无论是查询大型代码库、根据草图生成应用，还是执行复杂的 Git 操作，gemini-cli 都能通过自然语言指令高效处理。\n\n它特别适合广大软件工程师、DevOps 人员及技术研究人员使用。其核心亮点包括支持高达 100 万 token 的超长上下文窗口，具备出色的逻辑推理能力；内置 Google 搜索、文件操作及 Shell 命令执行等实用工具；更独特的是，它支持 MCP（模型上下文协议），允许用户灵活扩展自定义集成，连接如图像生成等外部能力。此外，个人谷歌账号即可享受免费的额度支持，且项目基于 Apache 2.0 协议完全开源，是提升终端工作效率的理想助手。",100752,"2026-04-10T01:20:03",[45,13,15,14],{"id":63,"github_repo":64,"name":65,"description_en":66,"description_zh":67,"ai_summary_zh":68,"readme_en":69,"readme_zh":70,"quickstart_zh":71,"use_case_zh":72,"hero_image_url":73,"owner_login":74,"owner_name":75,"owner_avatar_url":76,"owner_bio":77,"owner_company":78,"owner_location":79,"owner_email":75,"owner_twitter":75,"owner_website":75,"owner_url":80,"languages":81,"stars":117,"forks":118,"last_commit_at":119,"license":120,"difficulty_score":32,"env_os":121,"env_gpu":122,"env_ram":123,"env_deps":124,"category_tags":134,"github_topics":136,"view_count":32,"oss_zip_url":75,"oss_zip_packed_at":75,"status":17,"created_at":149,"updated_at":150,"faqs":151,"releases":180},9836,"remsky\u002FKokoro-FastAPI","Kokoro-FastAPI","Dockerized FastAPI wrapper for Kokoro-82M text-to-speech model w\u002FCPU ONNX and NVIDIA GPU PyTorch support, handling, and auto-stitching","Kokoro-FastAPI 是一个为 Kokoro-82M 语音合成模型打造的轻量级封装工具，旨在让开发者能轻松部署高性能的文本转语音服务。它通过 Docker 容器化技术，屏蔽了底层环境配置的复杂性，解决了模型在 CPU 与 NVIDIA GPU 之间切换困难、依赖管理繁琐以及长文本处理需要手动拼接等痛点。\n\n这款工具特别适合后端开发者、AI 应用构建者以及希望将高质量语音功能集成到现有系统（如 OpenWebUI、SillyTavern）的技术人员。普通用户若具备基础的 Docker 操作能力，也可快速搭建本地语音服务进行体验。\n\nKokoro-FastAPI 的技术亮点在于其灵活性与功能性并重：它不仅支持英语、日语、中文等多种语言，还提供兼容 OpenAI 标准的 API 接口，便于无缝对接各类应用。此外，它具备自动长文本拼接、基于音素的音频生成、逐词时间戳字幕输出以及多声音混合等高级特性。内置的 Web 监控界面让用户能直观查看系统状态，而其对 CPU ONNX 和 GPU PyTorch 的双重支持，则确保了在不同硬件环境下都能获得高效的推理性能。无论是用于原型开发还是生产","Kokoro-FastAPI 是一个为 Kokoro-82M 语音合成模型打造的轻量级封装工具，旨在让开发者能轻松部署高性能的文本转语音服务。它通过 Docker 容器化技术，屏蔽了底层环境配置的复杂性，解决了模型在 CPU 与 NVIDIA GPU 之间切换困难、依赖管理繁琐以及长文本处理需要手动拼接等痛点。\n\n这款工具特别适合后端开发者、AI 应用构建者以及希望将高质量语音功能集成到现有系统（如 OpenWebUI、SillyTavern）的技术人员。普通用户若具备基础的 Docker 操作能力，也可快速搭建本地语音服务进行体验。\n\nKokoro-FastAPI 的技术亮点在于其灵活性与功能性并重：它不仅支持英语、日语、中文等多种语言，还提供兼容 OpenAI 标准的 API 接口，便于无缝对接各类应用。此外，它具备自动长文本拼接、基于音素的音频生成、逐词时间戳字幕输出以及多声音混合等高级特性。内置的 Web 监控界面让用户能直观查看系统状态，而其对 CPU ONNX 和 GPU PyTorch 的双重支持，则确保了在不同硬件环境下都能获得高效的推理性能。无论是用于原型开发还是生产环境部署，它都是一个稳定且易用的选择。","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_4dc47bbe8cf5.png\" alt=\"Kokoro TTS Banner\">\n\u003C\u002Fp>\n\n# \u003Csub>\u003Csub>_`FastKoko`_ \u003C\u002Fsub>\u003C\u002Fsub>\n[![Tests](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftests-69-darkgreen)]()\n[![Coverage](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcoverage-54%25-tan)]()\n[![Try on Spaces](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Try%20on-Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FRemsky\u002FKokoro-TTS-Zero)\n\n[![Kokoro](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fkokoro-0.9.2-BB5420)](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fkokoro)\n[![Misaki](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmisaki-0.9.3-B8860B)](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fmisaki)\n\n[![Tested at Model Commit](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flast--tested--model--commit-1.0::9901c2b-blue)](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M\u002Fcommit\u002F9901c2b79161b6e898b7ea857ae5298f47b8b0d6)\n\nDockerized FastAPI wrapper for [Kokoro-82M](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M) text-to-speech model\n- Multi-language support (English, Japanese, Chinese, _Vietnamese soon_)\n- OpenAI-compatible Speech endpoint, NVIDIA GPU accelerated or CPU inference with PyTorch \n- ONNX support coming soon, see v0.1.5 and earlier for legacy ONNX support in the interim\n- Debug endpoints for monitoring system stats, integrated web UI on localhost:8880\u002Fweb\n- Phoneme-based audio generation, phoneme generation\n- Per-word timestamped caption generation\n- Voice mixing with weighted combinations\n\n### Integration Guides\n [![Helm Chart](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHelm%20Chart-black?style=flat&logo=helm&logoColor=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FSetup-Kubernetes) [![DigitalOcean](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDigitalOcean-black?style=flat&logo=digitalocean&logoColor=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-DigitalOcean) [![SillyTavern](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSillyTavern-black?style=flat&color=red)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-SillyTavern)\n[![OpenWebUI](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FOpenWebUI-black?style=flat&color=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-OpenWebUi)\n## Get Started\n\n\u003Cdetails>\n\u003Csummary>Quickest Start (docker run)\u003C\u002Fsummary>\n\n\nPre built images are available to run, with arm\u002Fmulti-arch support, and baked in models\nRefer to the core\u002Fconfig.py file for a full list of variables which can be managed via the environment\n\n```bash\n# the `latest` tag can be used, though it may have some unexpected bonus features which impact stability.\n Named versions should be pinned for your regular usage.\n Feedback\u002Ftesting is always welcome\n\ndocker run -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-cpu:latest # CPU, or:\ndocker run --gpus all -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-gpu:latest  #NVIDIA GPU\n```\n\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\n\u003Csummary>Quick Start (docker compose) \u003C\u002Fsummary>\n\n1. Install prerequisites, and start the service using Docker Compose (Full setup including UI):\n   - Install [Docker](https:\u002F\u002Fwww.docker.com\u002Fproducts\u002Fdocker-desktop\u002F)\n   - Clone the repository:\n        ```bash\n        git clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\n        cd Kokoro-FastAPI\n\n        cd docker\u002Fgpu  # For GPU support\n        # or cd docker\u002Fcpu  # For CPU support\n        docker compose up --build\n\n        # *Note for Apple Silicon (M1\u002FM2) users:\n        # The current GPU build relies on CUDA, which is not supported on Apple Silicon.  \n        # If you are on an M1\u002FM2\u002FM3 Mac, please use the `docker\u002Fcpu` setup.  \n        # MPS (Apple's GPU acceleration) support is planned but not yet available.\n\n        # Models will auto-download, but if needed you can manually download:\n        python docker\u002Fscripts\u002Fdownload_model.py --output api\u002Fsrc\u002Fmodels\u002Fv1_0\n\n        # Or run directly via UV:\n        .\u002Fstart-gpu.sh  # For GPU support\n        .\u002Fstart-cpu.sh  # For CPU support\n        ```\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>Direct Run (via uv) \u003C\u002Fsummary>\n\n1. Install prerequisites ():\n   - Install [astral-uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F)\n   - Install [espeak-ng](https:\u002F\u002Fgithub.com\u002Fespeak-ng\u002Fespeak-ng) in your system if you want it available as a fallback for unknown words\u002Fsounds. The upstream libraries may attempt to handle this, but results have varied.\n   - Clone the repository:\n        ```bash\n        git clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\n        cd Kokoro-FastAPI\n        ```\n        \n        Run the [model download script](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fblob\u002Fmaster\u002Fdocker\u002Fscripts\u002Fdownload_model.py) if you haven't already\n     \n        Start directly via UV (with hot-reload)\n        \n        Linux and macOS\n        ```bash\n        .\u002Fstart-cpu.sh OR\n        .\u002Fstart-gpu.sh \n        ```\n\n        Windows\n        ```powershell\n        .\\start-cpu.ps1 OR\n        .\\start-gpu.ps1 \n        ```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails open>\n\u003Csummary> Up and Running? \u003C\u002Fsummary>\n\n\nRun locally as an OpenAI-Compatible Speech Endpoint\n    \n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"not-needed\"\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_sky+af_bella\", #single or multiple voicepack combo\n    input=\"Hello world!\"\n  ) as response:\n      response.stream_to_file(\"output.mp3\")\n```\n  \n- The API will be available at http:\u002F\u002Flocalhost:8880\n- API Documentation: http:\u002F\u002Flocalhost:8880\u002Fdocs\n\n- Web Interface: http:\u002F\u002Flocalhost:8880\u002Fweb\n\n\u003Cdiv align=\"center\" style=\"display: flex; justify-content: center; gap: 10px;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_c3caed83c374.png\" width=\"42%\" alt=\"API Documentation\" style=\"border: 2px solid #333; padding: 10px;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_7c425fd89b03.png\" width=\"42%\" alt=\"Web UI Screenshot\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fdiv>\n\n\u003C\u002Fdetails>\n\n## Features \n\n\u003Cdetails>\n\u003Csummary>OpenAI-Compatible Speech Endpoint\u003C\u002Fsummary>\n\n```python\n# Using OpenAI's Python library\nfrom openai import OpenAI\nclient = OpenAI(base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"not-needed\")\nresponse = client.audio.speech.create(\n    model=\"kokoro\",  \n    voice=\"af_bella+af_sky\", # see \u002Fapi\u002Fsrc\u002Fcore\u002Fopenai_mappings.json to customize\n    input=\"Hello world!\",\n    response_format=\"mp3\"\n)\n\nresponse.stream_to_file(\"output.mp3\")\n```\nOr Via Requests:\n```python\nimport requests\n\n\nresponse = requests.get(\"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\")\nvoices = response.json()[\"voices\"]\n\n# Generate audio\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"model\": \"kokoro\",  \n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"response_format\": \"mp3\",  # Supported: mp3, wav, opus, flac\n        \"speed\": 1.0\n    }\n)\n\n# Save audio\nwith open(\"output.mp3\", \"wb\") as f:\n    f.write(response.content)\n```\n\nQuick tests (run from another terminal):\n```bash\npython examples\u002Fassorted_checks\u002Ftest_openai\u002Ftest_openai_tts.py # Test OpenAI Compatibility\npython examples\u002Fassorted_checks\u002Ftest_voices\u002Ftest_all_voices.py # Test all available voices\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Voice Combination\u003C\u002Fsummary>\n\n- Weighted voice combinations using ratios (e.g., \"af_bella(2)+af_heart(1)\" for 67%\u002F33% mix)\n- Ratios are automatically normalized to sum to 100%\n- Available through any endpoint by adding weights in parentheses\n- Saves generated voicepacks for future use\n\nCombine voices and generate audio:\n```python\nimport requests\nresponse = requests.get(\"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\")\nvoices = response.json()[\"voices\"]\n\n# Example 1: Simple voice combination (50%\u002F50% mix)\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella+af_sky\",  # Equal weights\n        \"response_format\": \"mp3\"\n    }\n)\n\n# Example 2: Weighted voice combination (67%\u002F33% mix)\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella(2)+af_sky(1)\",  # 2:1 ratio = 67%\u002F33%\n        \"response_format\": \"mp3\"\n    }\n)\n\n# Example 3: Download combined voice as .pt file\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\u002Fcombine\",\n    json=\"af_bella(2)+af_sky(1)\"  # 2:1 ratio = 67%\u002F33%\n)\n\n# Save the .pt file\nwith open(\"combined_voice.pt\", \"wb\") as f:\n    f.write(response.content)\n\n# Use the downloaded voice file\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"combined_voice\",  # Use the saved voice file\n        \"response_format\": \"mp3\"\n    }\n)\n\n```\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_94d53f706315.png\" width=\"80%\" alt=\"Voice Analysis Comparison\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Multiple Output Audio Formats\u003C\u002Fsummary>\n\n- mp3\n- wav\n- opus \n- flac\n- m4a\n- pcm\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_063b4c382e1c.png\" width=\"80%\" alt=\"Audio Format Comparison\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Streaming Support\u003C\u002Fsummary>\n\n```python\n# OpenAI-compatible streaming\nfrom openai import OpenAI\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"not-needed\")\n\n# Stream to file\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_bella\",\n    input=\"Hello world!\"\n) as response:\n    response.stream_to_file(\"output.mp3\")\n\n# Stream to speakers (requires PyAudio)\nimport pyaudio\nplayer = pyaudio.PyAudio().open(\n    format=pyaudio.paInt16, \n    channels=1, \n    rate=24000, \n    output=True\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_bella\",\n    response_format=\"pcm\",\n    input=\"Hello world!\"\n) as response:\n    for chunk in response.iter_bytes(chunk_size=1024):\n        player.write(chunk)\n```\n\nOr via requests:\n```python\nimport requests\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"response_format\": \"pcm\"\n    },\n    stream=True\n)\n\nfor chunk in response.iter_content(chunk_size=1024):\n    if chunk:\n        # Process streaming chunks\n        pass\n```\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_914f38386b54.png\" width=\"45%\" alt=\"GPU First Token Timeline\" style=\"border: 2px solid #333; padding: 10px; margin-right: 1%;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_261a726ff455.png\" width=\"45%\" alt=\"CPU First Token Timeline\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\nKey Streaming Metrics:\n- First token latency @ chunksize\n    - ~300ms  (GPU) @ 400 \n    - ~3500ms (CPU) @ 200 (older i7)\n    - ~\u003C1s    (CPU) @ 200 (M3 Pro)\n- Adjustable chunking settings for real-time playback \n\n*Note: Artifacts in intonation can increase with smaller chunks*\n\u003C\u002Fdetails>\n\n## Processing Details\n\u003Cdetails>\n\u003Csummary>Performance Benchmarks\u003C\u002Fsummary>\n\nBenchmarking was performed on generation via the local API using text lengths up to feature-length books (~1.5 hours output), measuring processing time and realtime factor. Tests were run on: \n- Windows 11 Home w\u002F WSL2 \n- NVIDIA 4060Ti 16gb GPU @ CUDA 12.1\n- 11th Gen i7-11700 @ 2.5GHz\n- 64gb RAM\n- WAV native output\n- H.G. Wells - The Time Machine (full text)\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_a2b9482a9182.png\" width=\"45%\" alt=\"Processing Time\" style=\"border: 2px solid #333; padding: 10px; margin-right: 1%;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_936b233ca4a6.png\" width=\"45%\" alt=\"Realtime Factor\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\nKey Performance Metrics:\n- Realtime Speed: Ranges between 35x-100x (generation time to output audio length)\n- Average Processing Rate: 137.67 tokens\u002Fsecond (cl100k_base)\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>GPU Vs. CPU\u003C\u002Fsummary>\n\n```bash\n# GPU: Requires NVIDIA GPU with CUDA 12.8 support (~35x-100x realtime speed)\ncd docker\u002Fgpu\ndocker compose up --build\n\n# CPU: PyTorch CPU inference\ncd docker\u002Fcpu\ndocker compose up --build\n\n```\n*Note: Overall speed may have reduced somewhat with the structural changes to accommodate streaming. Looking into it* \n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Natural Boundary Detection\u003C\u002Fsummary>\n\n- Automatically splits and stitches at sentence boundaries \n- Helps to reduce artifacts and allow long form processing as the base model is only currently configured for approximately 30s output\n\nThe model is capable of processing up to a 510 phonemized token chunk at a time, however, this can often lead to 'rushed' speech or other artifacts. An additional layer of chunking is applied in the server, that creates flexible chunks with a `TARGET_MIN_TOKENS` , `TARGET_MAX_TOKENS`, and `ABSOLUTE_MAX_TOKENS` which are configurable via environment variables, and set to 175, 250, 450 by default\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Timestamped Captions & Phonemes\u003C\u002Fsummary>\n\nGenerate audio with word-level timestamps without streaming:\n```python\nimport requests\nimport base64\nimport json\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fcaptioned_speech\",\n    json={\n        \"model\": \"kokoro\",\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"speed\": 1.0,\n        \"response_format\": \"mp3\",\n        \"stream\": False,\n    },\n    stream=False\n)\n\nwith open(\"output.mp3\",\"wb\") as f:\n\n    audio_json=json.loads(response.content)\n    \n    # Decode base 64 stream to bytes\n    chunk_audio=base64.b64decode(audio_json[\"audio\"].encode(\"utf-8\"))\n    \n    # Process streaming chunks\n    f.write(chunk_audio)\n    \n    # Print word level timestamps\n    print(audio_json[\"timestamps\"])\n```\n\nGenerate audio with word-level timestamps with streaming:\n```python\nimport requests\nimport base64\nimport json\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fcaptioned_speech\",\n    json={\n        \"model\": \"kokoro\",\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"speed\": 1.0,\n        \"response_format\": \"mp3\",\n        \"stream\": True,\n    },\n    stream=True\n)\n\nf=open(\"output.mp3\",\"wb\")\nfor chunk in response.iter_lines(decode_unicode=True):\n    if chunk:\n        chunk_json=json.loads(chunk)\n        \n        # Decode base 64 stream to bytes\n        chunk_audio=base64.b64decode(chunk_json[\"audio\"].encode(\"utf-8\"))\n        \n        # Process streaming chunks\n        f.write(chunk_audio)\n        \n        # Print word level timestamps\n        print(chunk_json[\"timestamps\"])\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Phoneme & Token Routes\u003C\u002Fsummary>\n\nConvert text to phonemes and\u002For generate audio directly from phonemes:\n```python\nimport requests\n\ndef get_phonemes(text: str, language: str = \"a\"):\n    \"\"\"Get phonemes and tokens for input text\"\"\"\n    response = requests.post(\n        \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fphonemize\",\n        json={\"text\": text, \"language\": language}  # \"a\" for American English\n    )\n    response.raise_for_status()\n    result = response.json()\n    return result[\"phonemes\"], result[\"tokens\"]\n\ndef generate_audio_from_phonemes(phonemes: str, voice: str = \"af_bella\"):\n    \"\"\"Generate audio from phonemes\"\"\"\n    response = requests.post(\n        \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fgenerate_from_phonemes\",\n        json={\"phonemes\": phonemes, \"voice\": voice},\n        headers={\"Accept\": \"audio\u002Fwav\"}\n    )\n    if response.status_code != 200:\n        print(f\"Error: {response.text}\")\n        return None\n    return response.content\n\n# Example usage\ntext = \"Hello world!\"\ntry:\n    # Convert text to phonemes\n    phonemes, tokens = get_phonemes(text)\n    print(f\"Phonemes: {phonemes}\")  # e.g. ðɪs ɪz ˈoʊnli ɐ tˈɛst\n    print(f\"Tokens: {tokens}\")      # Token IDs including start\u002Fend tokens\n\n    # Generate and save audio\n    if audio_bytes := generate_audio_from_phonemes(phonemes):\n        with open(\"speech.wav\", \"wb\") as f:\n            f.write(audio_bytes)\n        print(f\"Generated {len(audio_bytes)} bytes of audio\")\nexcept Exception as e:\n    print(f\"Error: {e}\")\n```\n\nSee `examples\u002Fphoneme_examples\u002Fgenerate_phonemes.py` for a sample script.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Debug Endpoints\u003C\u002Fsummary>\n\nMonitor system state and resource usage with these endpoints:\n\n- `\u002Fdebug\u002Fthreads` - Get thread information and stack traces\n- `\u002Fdebug\u002Fstorage` - Monitor temp file and output directory usage\n- `\u002Fdebug\u002Fsystem` - Get system information (CPU, memory, GPU)\n- `\u002Fdebug\u002Fsession_pools` - View ONNX session and CUDA stream status\n\nUseful for debugging resource exhaustion or performance issues.\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Logging\u003C\u002Fsummary>\n\nGlobal API [loguru logging level](https:\u002F\u002Floguru.readthedocs.io\u002Fen\u002Fstable\u002Fapi\u002Flogger.html#levels) can be set using the `API_LOG_LEVEL` environment variable. Defaults to `DEBUG`.\n\n**Docker**\n\nModify the appropriate compose `yml` or append to command line.\n```bash\ndocker run --env 'API_LOG_LEVEL=WARNING' ...\n```\n\n**Direct via UV**\n\nLinux and macOS\n```bash\nexport API_LOG_LEVEL=WARNING\n.\u002Fstart-cpu.sh OR\n.\u002Fstart-gpu.sh\n```\n\nWindows\n```powershell\n$env:API_LOG_LEVEL = 'WARNING'\n.\\start-cpu.ps1 OR\n.\\start-gpu.ps1\n```\n\u003C\u002Fdetails>\n\n## Known Issues & Troubleshooting\n\n\u003Cdetails>\n\u003Csummary>Missing words & Missing some timestamps\u003C\u002Fsummary>\n\nThe api will automaticly do text normalization on input text which may incorrectly remove or change some phrases. This can be disabled by adding `\"normalization_options\":{\"normalize\": false}` to your request json:\n```python\nimport requests\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_heart\",\n        \"response_format\": \"pcm\",\n        \"normalization_options\":\n        {\n            \"normalize\": False\n        }\n    },\n    stream=True\n)\n\nfor chunk in response.iter_content(chunk_size=1024):\n    if chunk:\n        # Process streaming chunks\n        pass\n```\n  \n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Versioning & Development\u003C\u002Fsummary>\n\n**Branching Strategy:**\n*   **`release` branch:** Contains the latest stable build, recommended for production use. Docker images tagged with specific versions (e.g., `v0.3.0`) are built from this branch.\n*   **`master` branch:** Used for active development. It may contain experimental features, ongoing changes, or fixes not yet in a stable release. Use this branch if you want the absolute latest code, but be aware it might be less stable. The `latest` Docker tag often points to builds from this branch.\n\nNote: This is a *development* focused project at its core. \n\nIf you run into trouble, you may have to roll back a version on the release tags if something comes up, or build up from source and\u002For troubleshoot + submit a PR.\n\nFree and open source is a community effort, and there's only really so many hours in a day. If you'd like to support the work, feel free to open a PR, buy me a coffee, or report any bugs\u002Ffeatures\u002Fetc you find during use.\n\n  \u003Ca href=\"https:\u002F\u002Fwww.buymeacoffee.com\u002Fremsky\" target=\"_blank\">\n    \u003Cimg \n      src=\"https:\u002F\u002Fcdn.buymeacoffee.com\u002Fbuttons\u002Fv2\u002Fdefault-violet.png\" \n      alt=\"Buy Me A Coffee\" \n      style=\"height: 30px !important;width: 110px !important;\"\n    >\n  \u003C\u002Fa>\n\n  \n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Linux GPU Permissions\u003C\u002Fsummary>\n\nSome Linux users may encounter GPU permission issues when running as non-root. \nCan't guarantee anything, but here are some common solutions, consider your security requirements carefully\n\n### Option 1: Container Groups (Likely the best option)\n```yaml\nservices:\n  kokoro-tts:\n    # ... existing config ...\n    group_add:\n      - \"video\"\n      - \"render\"\n```\n\n### Option 2: Host System Groups\n```yaml\nservices:\n  kokoro-tts:\n    # ... existing config ...\n    user: \"${UID}:${GID}\"\n    group_add:\n      - \"video\"\n```\nNote: May require adding host user to groups: `sudo usermod -aG docker,video $USER` and system restart.\n\n### Option 3: Device Permissions (Use with caution)\n```yaml\nservices:\n  kokoro-tts:\n    # ... existing config ...\n    devices:\n      - \u002Fdev\u002Fnvidia0:\u002Fdev\u002Fnvidia0\n      - \u002Fdev\u002Fnvidiactl:\u002Fdev\u002Fnvidiactl\n      - \u002Fdev\u002Fnvidia-uvm:\u002Fdev\u002Fnvidia-uvm\n```\n⚠️ Warning: Reduces system security. Use only in development environments.\n\nPrerequisites: NVIDIA GPU, drivers, and container toolkit must be properly configured.\n\nVisit [NVIDIA Container Toolkit installation](https:\u002F\u002Fdocs.nvidia.com\u002Fdatacenter\u002Fcloud-native\u002Fcontainer-toolkit\u002Flatest\u002Finstall-guide.html) for more detailed information\n\n\u003C\u002Fdetails>\n\n## Model and License\n\n\u003Cdetails open>\n\u003Csummary>Model\u003C\u002Fsummary>\n\nThis API uses the [Kokoro-82M](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M) model from HuggingFace. \n\nVisit the model page for more details about training, architecture, and capabilities. I have no affiliation with any of their work, and produced this wrapper for ease of use and personal projects.\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>License\u003C\u002Fsummary>\nThis project is licensed under the Apache License 2.0 - see below for details:\n\n- The Kokoro model weights are licensed under Apache 2.0 (see [model page](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M))\n- The FastAPI wrapper code in this repository is licensed under Apache 2.0 to match\n- The inference code adapted from StyleTTS2 is MIT licensed\n\nThe full Apache 2.0 license text can be found at: https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\u003C\u002Fdetails>\n\n\u003C\u002Fdetails open>\n\n## Contributor Stats\n![Alt](https:\u002F\u002Frepobeats.axiom.co\u002Fapi\u002Fembed\u002Ff9694366bf96febc749d592316ff0a275fe77219.svg \"Repobeats analytics image\")\n\u003C\u002Fdetails>\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_430cc2a990c2.png\" \u002F>\n\u003C\u002Fa>\n\nMade with [contrib.rocks](https:\u002F\u002Fcontrib.rocks).","\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_4dc47bbe8cf5.png\" alt=\"Kokoro TTS Banner\">\n\u003C\u002Fp>\n\n# \u003Csub>\u003Csub>_`FastKoko`_ \u003C\u002Fsub>\u003C\u002Fsub>\n[![测试](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Ftests-69-darkgreen)]()\n[![覆盖率](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcoverage-54%25-tan)]()\n[![在Spaces上试用](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F%F0%9F%A4%97%20Try%20on-Spaces-blue)](https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FRemsky\u002FKokoro-TTS-Zero)\n\n[![Kokoro](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fkokoro-0.9.2-BB5420)](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fkokoro)\n[![Misaki](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fmisaki-0.9.3-B8860B)](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fmisaki)\n\n[![最后测试的模型提交](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flast--tested--model--commit-1.0::9901c2b-blue)](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M\u002Fcommit\u002F9901c2b79161b6e898b7ea857ae5298f47b8b0d6)\n\n针对[Kokoro-82M](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M)文本转语音模型的Docker化FastAPI封装\n- 多语言支持（英语、日语、中文，_越南语即将加入_）\n- 兼容OpenAI的语音端点，可使用NVIDIA GPU加速或基于PyTorch的CPU推理\n- ONNX支持即将推出；在此之前，请参阅v0.1.5及更早版本以获取旧版ONNX支持\n- 调试端点用于监控系统状态，集成本地Web界面，地址为localhost:8880\u002Fweb\n- 基于音素的音频生成与音素序列生成\n- 每个单词带时间戳的字幕生成\n- 支持加权组合的多声线混合\n\n### 集成指南\n [![Helm Chart](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FHelm%20Chart-black?style=flat&logo=helm&logoColor=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FSetup-Kubernetes) [![DigitalOcean](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDigitalOcean-black?style=flat&logo=digitalocean&logoColor=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-DigitalOcean) [![SillyTavern](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FSillyTavern-black?style=flat&color=red)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-SillyTavern)\n[![OpenWebUI](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FOpenWebUI-black?style=flat&color=white)](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fwiki\u002FIntegrations-OpenWebUi)\n## 开始使用\n\n\u003Cdetails>\n\u003Csummary>最快启动方式（docker run）\u003C\u002Fsummary>\n\n\n提供了预构建的镜像可供运行，支持arm\u002Fmulti-arch架构，并内置了模型。\n完整的环境变量列表可在core\u002Fconfig.py文件中找到。\n\n```bash\n# 可以使用`latest`标签，但可能会包含一些影响稳定性的额外功能。\n建议在常规使用中固定命名版本。\n欢迎提供反馈和测试意见。\n\ndocker run -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-cpu:latest # CPU，或者：\ndocker run --gpus all -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-gpu:latest  #NVIDIA GPU\n```\n\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\n\u003Csummary>快速启动方式（docker compose）\u003C\u002Fsummary>\n\n1. 安装先决条件，并使用Docker Compose启动服务（完整设置，包括UI）：\n   - 安装[Docker](https:\u002F\u002Fwww.docker.com\u002Fproducts\u002Fdocker-desktop\u002F)\n   - 克隆仓库：\n        ```bash\n        git clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\n        cd Kokoro-FastAPI\n\n        cd docker\u002Fgpu  # 对于GPU支持\n        # 或cd docker\u002Fcpu  # 对于CPU支持\n        docker compose up --build\n\n        # *注意：对于Apple Silicon（M1\u002FM2）用户：\n        # 当前的GPU版本依赖于CUDA，而CUDA并不支持Apple Silicon。  \n        # 如果您使用的是M1\u002FM2\u002FM3 Mac，请使用`docker\u002Fcpu`设置。  \n        # MPS（苹果的GPU加速）支持计划中，但尚未可用。\n\n        # 模型会自动下载，但如果需要，您可以手动下载：\n        python docker\u002Fscripts\u002Fdownload_model.py --output api\u002Fsrc\u002Fmodels\u002Fv1_0\n\n        # 或者直接通过UV运行：\n        .\u002Fstart-gpu.sh  # 对于GPU支持\n        .\u002Fstart-cpu.sh  # 对于CPU支持\n        ```\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>直接运行（通过uv）\u003C\u002Fsummary>\n\n1. 安装先决条件（）：\n   - 安装[astral-uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F)\n   - 如果希望在遇到未知单词或发音时作为备用方案，可在系统中安装[espeak-ng](https:\u002F\u002Fgithub.com\u002Fespeak-ng\u002Fespeak-ng)。上游库可能会尝试处理这种情况，但效果不一。\n   - 克隆仓库：\n        ```bash\n        git clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\n        cd Kokoro-FastAPI\n        ```\n        \n        如果尚未运行过，可执行[模型下载脚本](https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fblob\u002Fmaster\u002Fdocker\u002Fscripts\u002Fdownload_model.py)。\n     \n        直接通过UV启动（支持热重载）。\n        \n        Linux和macOS\n        ```bash\n        .\u002Fstart-cpu.sh OR\n        .\u002Fstart-gpu.sh \n        ```\n\n        Windows\n        ```powershell\n        .\\start-cpu.ps1 OR\n        .\\start-gpu.ps1 \n        ```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails open>\n\u003Csummary>已经运行起来了吗？\u003C\u002Fsummary>\n\n\n作为兼容OpenAI的语音端点，在本地运行：\n    \n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"不需要\"\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_sky+af_bella\", #单个或多个声线组合\n    input=\"Hello world!\"\n  ) as response:\n      response.stream_to_file(\"output.mp3\")\n```\n  \n- API将在http:\u002F\u002Flocalhost:8880可用。\n- API文档：http:\u002F\u002Flocalhost:8880\u002Fdocs\n\n- Web界面：http:\u002F\u002Flocalhost:8880\u002Fweb\n\n\u003Cdiv align=\"center\" style=\"display: flex; justify-content: center; gap: 10px;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_c3caed83c374.png\" width=\"42%\" alt=\"API文档\" style=\"border: 2px solid #333; padding: 10px;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_7c425fd89b03.png\" width=\"42%\" alt=\"Web界面截图\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fdiv>\n\n\u003C\u002Fdetails>\n\n## 功能 \n\n\u003Cdetails>\n\u003Csummary>兼容OpenAI的语音端点\u003C\u002Fsummary>\n\n```python\n# 使用OpenAI的Python库\nfrom openai import OpenAI\nclient = OpenAI(base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"不需要\")\nresponse = client.audio.speech.create(\n    model=\"kokoro\",  \n    voice=\"af_bella+af_sky\", # 可在\u002Fapi\u002Fsrc\u002Fcore\u002Fopenai_mappings.json中自定义\n    input=\"Hello world!\",\n    response_format=\"mp3\"\n)\n\nresponse.stream_to_file(\"output.mp3\")\n```\n或者通过Requests：\n```python\nimport requests\n\n\nresponse = requests.get(\"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\")\nvoices = response.json()[\"voices\"]\n\n# 生成音频\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"model\": \"kokoro\",  \n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"response_format\": \"mp3\",  # 支持：mp3、wav、opus、flac\n        \"speed\": 1.0\n    }\n)\n\n# 保存音频\nwith open(\"output.mp3\", \"wb\") as f:\n    f.write(response.content)\n```\n\n快速测试（从另一个终端运行）：\n```bash\npython examples\u002Fassorted_checks\u002Ftest_openai\u002Ftest_openai_tts.py # 测试 OpenAI 兼容性\npython examples\u002Fassorted_checks\u002Ftest_voices\u002Ftest_all_voices.py # 测试所有可用语音\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>语音组合\u003C\u002Fsummary>\n\n- 使用比例进行加权语音组合（例如，“af_bella(2)+af_heart(1)”表示67%\u002F33%的混合）\n- 比例会自动归一化为总和100%\n- 可通过任何端点以括号内添加权重的方式实现\n- 生成的语音包可保存以供将来使用\n\n组合语音并生成音频：\n```python\nimport requests\nresponse = requests.get(\"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\")\nvoices = response.json()[\"voices\"]\n\n# 示例1：简单语音组合（50%\u002F50%混合）\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella+af_sky\",  # 等权重\n        \"response_format\": \"mp3\"\n    }\n)\n\n# 示例2：加权语音组合（67%\u002F33%混合）\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella(2)+af_sky(1)\",  # 2:1比例 = 67%\u002F33%\n        \"response_format\": \"mp3\"\n    }\n)\n\n# 示例3：将组合语音下载为 .pt 文件\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices\u002Fcombine\",\n    json=\"af_bella(2)+af_sky(1)\"  # 2:1比例 = 67%\u002F33%\n)\n\n# 保存 .pt 文件\nwith open(\"combined_voice.pt\", \"wb\") as f:\n    f.write(response.content)\n\n# 使用下载的语音文件\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"combined_voice\",  # 使用保存的语音文件\n        \"response_format\": \"mp3\"\n    }\n)\n\n```\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_94d53f706315.png\" width=\"80%\" alt=\"语音分析对比\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>多种输出音频格式\u003C\u002Fsummary>\n\n- mp3\n- wav\n- opus \n- flac\n- m4a\n- pcm\n\n\u003Cp align=\"center\">\n\u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_063b4c382e1c.png\" width=\"80%\" alt=\"音频格式比较\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>流式传输支持\u003C\u002Fsummary>\n\n```python\n# OpenAI 兼容的流式传输\nfrom openai import OpenAI\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", api_key=\"not-needed\")\n\n# 流式传输到文件\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_bella\",\n    input=\"Hello world!\"\n) as response:\n    response.stream_to_file(\"output.mp3\")\n\n# 流式传输到扬声器（需要 PyAudio）\nimport pyaudio\nplayer = pyaudio.PyAudio().open(\n    format=pyaudio.paInt16, \n    channels=1, \n    rate=24000, \n    output=True\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_bella\",\n    response_format=\"pcm\",\n    input=\"Hello world!\"\n) as response:\n    for chunk in response.iter_bytes(chunk_size=1024):\n        player.write(chunk)\n```\n\n或者通过 requests：\n```python\nimport requests\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"response_format\": \"pcm\"\n    },\n    stream=True\n)\n\nfor chunk in response.iter_content(chunk_size=1024):\n    if chunk:\n        # 处理流式传输的每个数据块\n        pass\n```\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_914f38386b54.png\" width=\"45%\" alt=\"GPU 首个 token 时间线\" style=\"border: 2px solid #333; padding: 10px; margin-right: 1%;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_261a726ff455.png\" width=\"45%\" alt=\"CPU 首个 token 时间线\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\n关键流式传输指标：\n- 首个 token 延迟 @ 数据块大小\n    - ~300ms  (GPU) @ 400 \n    - ~3500ms (CPU) @ 200 (较旧的 i7)\n    - ~\u003C1s    (CPU) @ 200 (M3 Pro)\n- 可调整的分块设置，适用于实时播放 \n\n*注：音调方面可能会因分块过小而出现瑕疵*\n\u003C\u002Fdetails>\n\n## 处理细节\n\u003Cdetails>\n\u003Csummary>性能基准测试\u003C\u002Fsummary>\n\n基准测试是在本地 API 上进行的，文本长度最长可达长篇小说级别（约1.5小时的输出），测量了处理时间和实时因子。测试环境如下：\n- Windows 11 家庭版，搭载 WSL2\n- NVIDIA 4060Ti 16GB 显卡，CUDA 12.1\n- 第11代 i7-11700，2.5GHz\n- 64GB 内存\n- WAV 原生输出\n- H.G. Wells 的《时间机器》（全文）\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_a2b9482a9182.png\" width=\"45%\" alt=\"处理时间\" style=\"border: 2px solid #333; padding: 10px; margin-right: 1%;\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_936b233ca4a6.png\" width=\"45%\" alt=\"实时因子\" style=\"border: 2px solid #333; padding: 10px;\">\n\u003C\u002Fp>\n\n关键性能指标：\n- 实时速度：介于35倍至100倍之间（生成时间与音频输出长度之比）\n- 平均处理速率：137.67 tokens\u002F秒（cl100k_base）\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>GPU 与 CPU 对比\u003C\u002Fsummary>\n\n```bash\n# GPU：需要支持 CUDA 12.8 的 NVIDIA 显卡（实时速度约为35倍至100倍）\ncd docker\u002Fgpu\ndocker compose up --build\n\n# CPU：PyTorch CPU 推理\ncd docker\u002Fcpu\ndocker compose up --build\n\n```\n*注：为了支持流式传输而进行的结构调整可能导致整体速度有所下降。正在进一步调查中。*\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>自然边界检测\u003C\u002Fsummary>\n\n- 自动在句子边界处分割和拼接\n- 有助于减少伪影，并支持长文本处理，因为基础模型目前仅配置为生成约30秒的输出。\n\n该模型一次最多可处理510个音素化标记的片段，但这样往往会导致语速过快或其他伪影。因此，服务器端额外增加了一层切块逻辑，根据 `TARGET_MIN_TOKENS`、`TARGET_MAX_TOKENS` 和 `ABSOLUTE_MAX_TOKENS` 参数动态生成灵活的片段，这些参数可通过环境变量配置，默认值分别为175、250和450。\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>带时间戳的字幕与音素\u003C\u002Fsummary>\n\n不使用流式传输生成带单词级时间戳的音频：\n```python\nimport requests\nimport base64\nimport json\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fcaptioned_speech\",\n    json={\n        \"model\": \"kokoro\",\n        \"input\": \"你好，世界！\",\n        \"voice\": \"af_bella\",\n        \"speed\": 1.0,\n        \"response_format\": \"mp3\",\n        \"stream\": False,\n    },\n    stream=False\n)\n\nwith open(\"output.mp3\",\"wb\") as f:\n\n    audio_json=json.loads(response.content)\n    \n    # 将Base64编码的音频流解码为字节\n    chunk_audio=base64.b64decode(audio_json[\"audio\"].encode(\"utf-8\"))\n    \n    # 处理流式传输的音频块\n    f.write(chunk_audio)\n    \n    # 打印单词级时间戳\n    print(audio_json[\"timestamps\"])\n```\n\n使用流式传输生成带单词级时间戳的音频：\n```python\nimport requests\nimport base64\nimport json\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fcaptioned_speech\",\n    json={\n        \"model\": \"kokoro\",\n        \"input\": \"你好，世界！\",\n        \"voice\": \"af_bella\",\n        \"speed\": 1.0,\n        \"response_format\": \"mp3\",\n        \"stream\": True,\n    },\n    stream=True\n)\n\nf=open(\"output.mp3\",\"wb\")\nfor chunk in response.iter_lines(decode_unicode=True):\n    if chunk:\n        chunk_json=json.loads(chunk)\n        \n        # 将Base64编码的音频流解码为字节\n        chunk_audio=base64.b64decode(chunk_json[\"audio\"].encode(\"utf-8\"))\n        \n        # 处理流式传输的音频块\n        f.write(chunk_audio)\n        \n        # 打印单词级时间戳\n        print(chunk_json[\"timestamps\"])\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>音素与标记路由\u003C\u002Fsummary>\n\n将文本转换为音素，或直接从音素生成音频：\n```python\nimport requests\n\ndef get_phonemes(text: str, language: str = \"a\"):\n    \"\"\"获取输入文本的音素和标记\"\"\"\n    response = requests.post(\n        \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fphonemize\",\n        json={\"text\": text, \"language\": language}  # \"a\" 表示美式英语\n    )\n    response.raise_for_status()\n    result = response.json()\n    return result[\"phonemes\"], result[\"tokens\"]\n\ndef generate_audio_from_phonemes(phonemes: str, voice: str = \"af_bella\"):\n    \"\"\"根据音素生成音频\"\"\"\n    response = requests.post(\n        \"http:\u002F\u002Flocalhost:8880\u002Fdev\u002Fgenerate_from_phonemes\",\n        json={\"phonemes\": phonemes, \"voice\": voice},\n        headers={\"Accept\": \"audio\u002Fwav\"}\n    )\n    if response.status_code != 200:\n        print(f\"错误：{response.text}\")\n        return None\n    return response.content\n\n# 示例用法\ntext = \"你好，世界！\"\ntry:\n    # 将文本转换为音素\n    phonemes, tokens = get_phonemes(text)\n    print(f\"音素：{phonemes}\")  # 例如：ðɪs ɪz ˈoʊnli ɐ tˈɛst\n    print(f\"标记：{tokens}\")      # 包括开始和结束标记的标记ID\n\n    # 生成并保存音频\n    if audio_bytes := generate_audio_from_phonemes(phonemes):\n        with open(\"speech.wav\", \"wb\") as f:\n            f.write(audio_bytes)\n        print(f\"已生成 {len(audio_bytes)} 字节的音频\")\nexcept Exception as e:\n    print(f\"错误：{e}\")\n```\n\n更多示例请参阅 `examples\u002Fphoneme_examples\u002Fgenerate_phonemes.py`。\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>调试端点\u003C\u002Fsummary>\n\n通过以下端点监控系统状态和资源使用情况：\n\n- `\u002Fdebug\u002Fthreads` - 获取线程信息和堆栈跟踪\n- `\u002Fdebug\u002Fstorage` - 监控临时文件和输出目录的使用情况\n- `\u002Fdebug\u002Fsystem` - 获取系统信息（CPU、内存、GPU）\n- `\u002Fdebug\u002Fsession_pools` - 查看 ONNX 会话和 CUDA 流的状态\n\n这些端点对于调试资源耗尽或性能问题非常有用。\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>日志记录\u003C\u002Fsummary>\n\n全局 API 的 [loguru 日志级别](https:\u002F\u002Floguru.readthedocs.io\u002Fen\u002Fstable\u002Fapi\u002Flogger.html#levels) 可以通过 `API_LOG_LEVEL` 环境变量设置。默认值为 `DEBUG`。\n\n**Docker**\n\n修改相应的 compose `yml` 文件，或在命令行中追加：\n```bash\ndocker run --env 'API_LOG_LEVEL=WARNING' ...\n```\n\n**直接通过 UV**\n\nLinux 和 macOS\n```bash\nexport API_LOG_LEVEL=WARNING\n.\u002Fstart-cpu.sh 或 .\u002Fstart-gpu.sh\n```\n\nWindows\n```powershell\n$env:API_LOG_LEVEL = 'WARNING'\n.\\start-cpu.ps1 或 .\\start-gpu.ps1\n```\n\u003C\u002Fdetails>\n\n## 已知问题与故障排除\n\n\u003Cdetails>\n\u003Csummary>缺失词语及部分时间戳\u003C\u002Fsummary>\n\nAPI 会对输入文本自动进行文本归一化处理，这可能会错误地移除或更改某些短语。您可以通过在请求 JSON 中添加 `\"normalization_options\":{\"normalize\": false}` 来禁用此功能：\n```python\nimport requests\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"Hello world!\",\n        \"voice\": \"af_heart\",\n        \"response_format\": \"pcm\",\n        \"normalization_options\":\n        {\n            \"normalize\": False\n        }\n    },\n    stream=True\n)\n\nfor chunk in response.iter_content(chunk_size=1024):\n    if chunk:\n        # 处理流式传输的块\n        pass\n```\n  \n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>版本控制与开发\u003C\u002Fsummary>\n\n**分支策略：**\n*   **`release` 分支：** 包含最新的稳定版本，推荐用于生产环境。基于该分支构建的 Docker 镜像会打上特定版本标签（例如 `v0.3.0`）。\n*   **`master` 分支：** 用于活跃开发。该分支可能包含实验性功能、正在进行的更改或尚未进入稳定版的修复。如果您希望使用最新代码，请使用此分支，但请注意其稳定性可能较低。`latest` Docker 标签通常指向该分支的构建。\n\n注意：该项目本质上是一个以开发为主的项目。\n\n如果您遇到问题，可能需要回退到 release 标签中的某个版本，或者从源码构建并进行调试，同时提交 PR。\n\n开源是社区共同努力的结果，而每个人每天的时间都是有限的。如果您想支持这项工作，欢迎提交 PR、请我喝杯咖啡，或报告您在使用过程中发现的任何 bug 或功能需求等。\n\n  \u003Ca href=\"https:\u002F\u002Fwww.buymeacoffee.com\u002Fremsky\" target=\"_blank\">\n    \u003Cimg \n      src=\"https:\u002F\u002Fcdn.buymeacoffee.com\u002Fbuttons\u002Fv2\u002Fdefault-violet.png\" \n      alt=\"Buy Me A Coffee\" \n      style=\"height: 30px !important;width: 110px !important;\"\n    >\n  \u003C\u002Fa>\n\n  \n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Linux GPU 权限问题\u003C\u002Fsummary>\n\n部分 Linux 用户在以非 root 用户身份运行时可能会遇到 GPU 权限问题。\n我们无法保证解决方案的有效性，但以下是一些常见的解决方法，请务必根据您的安全需求谨慎选择。\n\n### 选项 1：容器组（可能是最佳选择）\n```yaml\nservices:\n  kokoro-tts:\n    # ... 现有配置 ...\n    group_add:\n      - \"video\"\n      - \"render\"\n```\n\n### 选项 2：主机系统组\n```yaml\nservices:\n  kokoro-tts:\n    # ... 现有配置 ...\n    user: \"${UID}:${GID}\"\n    group_add:\n      - \"video\"\n```\n注意：可能需要将主机用户添加到相关组中：`sudo usermod -aG docker,video $USER`，并重启系统。\n\n### 选项 3：设备权限（谨慎使用）\n```yaml\nservices:\n  kokoro-tts:\n    # ... 现有配置 ...\n    devices:\n      - \u002Fdev\u002Fnvidia0:\u002Fdev\u002Fnvidia0\n      - \u002Fdev\u002Fnvidiactl:\u002Fdev\u002Fnvidiactl\n      - \u002Fdev\u002Fnvidia-uvm:\u002Fdev\u002Fnvidia-uvm\n```\n⚠️ 警告：会降低系统安全性。仅适用于开发环境。\n\n前提条件：必须正确配置 NVIDIA GPU、驱动程序和容器工具包。\n\n更多详细信息请访问 [NVIDIA 容器工具包安装指南](https:\u002F\u002Fdocs.nvidia.com\u002Fdatacenter\u002Fcloud-native\u002Fcontainer-toolkit\u002Flatest\u002Finstall-guide.html)。\n\n\u003C\u002Fdetails>\n\n## 模型与许可证\n\n\u003Cdetails open>\n\u003Csummary>模型\u003C\u002Fsummary>\n\n本 API 使用来自 HuggingFace 的 [Kokoro-82M](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M) 模型。\n\n访问模型页面可了解更多关于训练、架构和功能的信息。我与他们的工作并无关联，制作此封装是为了方便使用和个人项目。\n\u003C\u002Fdetails>\n\u003Cdetails>\n\u003Csummary>许可证\u003C\u002Fsummary>\n本项目采用 Apache License 2.0 许可证——详情如下：\n\n- Kokoro 模型权重采用 Apache 2.0 许可证（详见 [模型页面](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M)）\n- 本仓库中的 FastAPI 封装代码也采用 Apache 2.0 许可证，以保持一致\n- 基于 StyleTTS2 改编的推理代码则采用 MIT 许可证\n\n完整的 Apache 2.0 许可证文本可在以下网址找到：https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0\n\u003C\u002Fdetails>\n\n\u003C\u002Fdetails open>\n\n## 贡献者统计\n![Alt](https:\u002F\u002Frepobeats.axiom.co\u002Fapi\u002Fembed\u002Ff9694366bf96febc749d592316ff0a275fe77219.svg \"Repobeats 分析图\")\n\u003C\u002Fdetails>\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_readme_430cc2a990c2.png\" \u002F>\n\u003C\u002Fa>\n\n由 [contrib.rocks](https:\u002F\u002Fcontrib.rocks) 制作。","# Kokoro-FastAPI 快速上手指南\n\nKokoro-FastAPI 是一个基于 Docker 的 FastAPI 封装器，用于运行 **Kokoro-82M** 文本转语音（TTS）模型。它支持多语言（英、日、中）、OpenAI 兼容接口、GPU\u002FCPU 推理以及声音混合等功能。\n\n## 环境准备\n\n### 系统要求\n- **操作系统**: Linux, macOS, Windows (WSL2 推荐)\n- **硬件**:\n  - **GPU 模式**: NVIDIA 显卡 (支持 CUDA 12.1+)，显存建议 8GB+\n  - **CPU 模式**: 任意现代 CPU (Apple Silicon M1\u002FM2\u002FM3 用户请使用 CPU 模式)\n- **软件依赖**:\n  - [Docker](https:\u002F\u002Fwww.docker.com\u002Fproducts\u002Fdocker-desktop\u002F) 和 Docker Compose\n  - 或者 [astral-uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F) (用于直接运行)\n  - `espeak-ng` (可选，作为生僻词发音的回退方案)\n\n> **注意**: Apple Silicon (M1\u002FM2\u002FM3) 用户目前不支持 CUDA GPU 加速，请使用 `docker\u002Fcpu` 配置或等待后续的 MPS 支持。\n\n## 安装步骤\n\n推荐使用 Docker 进行部署，最简单的方式是直接拉取预构建镜像。\n\n### 方式一：Docker 快速启动（推荐）\n\n无需克隆代码，直接运行容器。模型会自动下载。\n\n**CPU 版本:**\n```bash\ndocker run -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-cpu:latest\n```\n\n**NVIDIA GPU 版本:**\n```bash\ndocker run --gpus all -p 8880:8880 ghcr.io\u002Fremsky\u002Fkokoro-fastapi-gpu:latest\n```\n\n### 方式二：Docker Compose 完整部署\n\n如果你需要修改配置或使用 Web UI，可以克隆仓库运行。\n\n```bash\n# 1. 克隆仓库\ngit clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\ncd Kokoro-FastAPI\n\n# 2. 选择配置目录\n# GPU 用户进入:\ncd docker\u002Fgpu\n# CPU 用户进入:\n# cd docker\u002Fcpu\n\n# 3. 启动服务\ndocker compose up --build\n```\n\n### 方式三：本地直接运行 (via UV)\n\n适合开发者调试，支持热重载。\n\n```bash\n# 1. 安装 uv 和 espeak-ng (系统级)\n# 2. 克隆仓库\ngit clone https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI.git\ncd Kokoro-FastAPI\n\n# 3. 运行脚本\n# Linux\u002FmacOS\n.\u002Fstart-cpu.sh  # 或 .\u002Fstart-gpu.sh\n\n# Windows PowerShell\n.\\start-cpu.ps1 # 或 .\\start-gpu.ps1\n```\n\n## 基本使用\n\n服务启动后，API 默认运行在 `http:\u002F\u002Flocalhost:8880`。\n- **API 文档**: http:\u002F\u002Flocalhost:8880\u002Fdocs\n- **Web 界面**: http:\u002F\u002Flocalhost:8880\u002Fweb\n\n### 1. 使用 OpenAI Python SDK (推荐)\n\n该工具完全兼容 OpenAI 的 Speech 接口，只需更改 `base_url`。\n\n```python\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"http:\u002F\u002Flocalhost:8880\u002Fv1\", \n    api_key=\"not-needed\"  # 密钥随意填写\n)\n\nwith client.audio.speech.with_streaming_response.create(\n    model=\"kokoro\",\n    voice=\"af_sky+af_bella\",  # 支持单音色或多音色混合\n    input=\"Hello world! 欢迎使用 Kokoro TTS。\"\n) as response:\n    response.stream_to_file(\"output.mp3\")\n```\n\n### 2. 使用 HTTP 请求\n\n如果不使用 SDK，也可以直接发送 POST 请求。\n\n```python\nimport requests\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"model\": \"kokoro\",  \n        \"input\": \"Hello world!\",\n        \"voice\": \"af_bella\",\n        \"response_format\": \"mp3\",  # 支持 mp3, wav, opus, flac 等\n        \"speed\": 1.0\n    }\n)\n\nwith open(\"output.mp3\", \"wb\") as f:\n    f.write(response.content)\n```\n\n### 3. 高级功能：音色混合\n\n可以通过在音色名称后添加权重 `(数字)` 来混合不同音色。\n\n```python\n# 示例：af_bella 占 2\u002F3，af_sky 占 1\u002F3\nvoice_config = \"af_bella(2)+af_sky(1)\"\n\nresponse = requests.post(\n    \"http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fspeech\",\n    json={\n        \"input\": \"这是混合音色的测试。\",\n        \"voice\": voice_config,\n        \"response_format\": \"mp3\"\n    }\n)\n```\n\n### 可用音色与语言\n- 支持英语、日语、中文（及即将支持的越南语）。\n- 具体可用音色列表可通过访问 `http:\u002F\u002Flocalhost:8880\u002Fv1\u002Faudio\u002Fvoices` 查看。","一家小型游戏开发团队正在为独立 RPG 项目快速迭代多语言角色配音，需要频繁生成带有时间戳的对话音频以同步口型动画。\n\n### 没有 Kokoro-FastAPI 时\n- 开发者需手动配置复杂的 PyTorch 环境和模型依赖，在不同操作系统间迁移时经常遇到兼容性问题，耗费大量调试时间。\n- 生成多语言（中、日、英）语音需要切换不同的模型或 API 服务，导致工作流割裂，且难以统一管理语音风格。\n- 缺乏原生的字词级时间戳功能，团队必须编写额外的脚本强行对齐音频与文本，严重拖慢了口型动画的制作进度。\n- 本地推理无法有效利用 NVIDIA GPU 加速，生成一段长对话耗时过长，无法满足每日构建版本的即时测试需求。\n\n### 使用 Kokoro-FastAPI 后\n- 通过 Docker 一键部署预构建镜像，自动处理 CPU 或 GPU 环境适配，团队成员可在几分钟内搭建好一致的本地开发服务。\n- 单个接口即可支持中、日、英多语言混合输入，并能通过加权组合灵活混合不同音色，轻松实现角色情感变化的配音需求。\n- 直接调用内置接口获取精确到单词的音频时间戳数据，无缝对接动画引擎，将口型同步流程从数小时缩短至分钟级。\n- 自动识别并调用 NVIDIA GPU 进行加速推理，长文本语音生成速度提升显著，支持实时预览效果，大幅加快迭代循环。\n\nKokoro-FastAPI 将复杂的语音模型转化为标准化的生产管线，让小型团队也能以极低门槛实现高质量、多语言的自动化配音流程。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002Fremsky_Kokoro-FastAPI_c3caed83.png","remsky",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002Fremsky_3e69fb11.jpg","𝖨𝗇 𝗂𝗍 𝖿𝗈𝗋 𝗍𝗁𝖾 𝗉𝗅𝗈𝗍𝗌","Senior Data Scientist ","Canada","https:\u002F\u002Fgithub.com\u002Fremsky",[82,86,90,94,97,101,105,109,113],{"name":83,"color":84,"percentage":85},"Python","#3572A5",74.3,{"name":87,"color":88,"percentage":89},"JavaScript","#f1e05a",12.8,{"name":91,"color":92,"percentage":93},"CSS","#663399",6.6,{"name":95,"color":96,"percentage":32},"Shell","#89e051",{"name":98,"color":99,"percentage":100},"HTML","#e34c26",1.5,{"name":102,"color":103,"percentage":104},"Dockerfile","#384d54",1.4,{"name":106,"color":107,"percentage":108},"HCL","#844FBA",0.7,{"name":110,"color":111,"percentage":112},"Smarty","#f0c040",0.4,{"name":114,"color":115,"percentage":116},"PowerShell","#012456",0.2,4739,786,"2026-04-19T15:24:27","Apache-2.0","Linux, macOS, Windows","非必需。若使用 GPU 加速，需要 NVIDIA 显卡（支持 CUDA），测试环境为 NVIDIA 4060Ti 16GB (CUDA 12.1)。Apple Silicon (M1\u002FM2\u002FM3) 目前不支持 GPU 加速（MPS 尚未可用），需使用 CPU 模式。","未说明（测试环境为 64GB）",{"notes":125,"python":126,"dependencies":127},"1. 推荐使用 Docker 部署（提供 CPU 和 GPU 两个版本的镜像）。2. 若在 Apple Silicon Mac 上运行，必须使用 CPU 版本镜像或脚本，因为当前不支持 MPS 加速。3. 系统需安装 espeak-ng 以处理未知单词发音。4. 模型文件会自动下载，也可手动运行脚本下载。5. 支持 OpenAI 兼容的语音接口，可混合多种声音并生成带时间戳的字幕。","未说明（通过 uv 或 Docker 管理）",[128,129,130,131,132,133],"torch","kokoro (0.9.2+)","misaki (0.9.3+)","espeak-ng (系统级依赖)","fastapi","openai",[135,45,15,14],"音频",[132,137,138,139,140,141,142,143,144,145,146,147,148],"tts","tts-api","huggingface-spaces","kokoro","kokoro-tts","onnx","onnxruntime","pytorch","openai-compatible-api","uv","openwebui","sillytavern","2026-03-27T02:49:30.150509","2026-04-20T07:16:11.351313",[152,157,162,167,171,176],{"id":153,"question_zh":154,"answer_zh":155,"source_url":156},44165,"如何在 AMD GPU (ROCM) 上运行该项目？","目前官方尚未完全原生支持，但社区提供了 Fork 版本和 Docker Compose 配置供测试。用户反馈在 Ubuntu 24.04 + RX 7900 XTX 上运行时，容器内可能无法识别 `\u002Fdev\u002Fkfd` 或 `\u002Fdev\u002Fdri` 设备。解决方法包括：尝试移除设备标志或使用 `privileged` 标志运行容器。如果容器内 `rocminfo` 提示未加载模块，请确保宿主机驱动正确安装（可参考 ollama 或 alltalk_tts 的配置）。相关代码可参考用户 @bgs4free 的 Fork。","https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F66",{"id":158,"question_zh":159,"answer_zh":160,"source_url":161},44166,"使用长文本生成音频时，为什么只输出了第一句话？","这是一个已知问题，特别是在使用 `response_format: wav` 或直接保存流式响应到文件时，可能导致音频在第一句后截断。临时解决方案是使用 `pyaudio` 进行流式播放而非直接保存文件。维护者已确认该问题并在 PR #94 中针对 WAV 格式进行了修复。如果仍遇到问题，建议尝试更新到最新代码或检查是否使用了已修复的版本。","https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F57",{"id":163,"question_zh":164,"answer_zh":165,"source_url":166},44167,"该项目是否需要联网才能运行？如何解决国内网络无法下载模型的问题？","项目启动时默认会尝试从 GitHub 下载 `en-core-web-sm` 等模型文件，若无网络会导致启动失败。解决方法：1. 手动下载所需的 `.whl` 文件（如 `en_core_web_sm-3.7.1-py3-none-any.whl`）；2. 对于 CPU 版本，构建过程还会从 debian.org 下载大量小文件，网络不佳时建议使用 `docker run` 直接运行预构建镜像而非使用 `docker-compose` 构建，以减少下载失败重试的成本；3. 若有条件，可克隆仓库后修改配置以使用本地模型路径。","https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F190",{"id":168,"question_zh":169,"answer_zh":170,"source_url":156},44168,"Intel Arc GPU 是否支持运行此项目？","理论上通过 oneDNN 执行器可以支持 ONNX 模型，但由于不支持某些算子，OpenVino 可能无法工作。不过，已有社区成员实现了基于 IPEX (Intel Extension for PyTorch) 的版本，其代码结构与 CUDA 版本几乎一致，可在 Intel Arc GPU 上运行。详情请参考用户 @TheMrCodes 的 Fork 仓库或 Issue #106。",{"id":172,"question_zh":173,"answer_zh":174,"source_url":175},44169,"Docker 镜像版本号与发布标签不一致怎么办？","有用户反馈构建流水线存在异常，例如 v0.2.3 的构建任务生成的镜像却被标记为 v0.2.1。遇到此类问题时，建议不要仅依赖标签版本号，而是查看 GitHub Actions 的原始构建日志（Raw logs）确认实际生成的镜像哈希值或内部版本信息。如果功能正常（如音频生成长度正常），可暂时忽略标签错误；若功能异常，建议回退到已知稳定的旧版本镜像或等待维护者修复流水线。","https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F229",{"id":177,"question_zh":178,"answer_zh":179,"source_url":166},44170,"CPU 版本和 GPU 版本应该如何选择？","选择取决于你的硬件环境。如果你没有 NVIDIA GPU 或显存不足，应直接使用 CPU 版本的镜像（如 `kokoro-fastapi-cpu`），这样可以避免处理 CUDA 驱动和显存相关问题。虽然 CPU 版本在构建时仍需从网络下载依赖（如 debian 包），但运行时不需要 GPU 环境。对于网络环境较差的用户，直接运行预构建的 CPU 镜像通常比尝试构建 GPU 镜像更容易成功。",[181,186,191,196,201,206,211,216,221,226,231,236,241,246,251],{"id":182,"version":183,"summary_zh":184,"released_at":185},351716,"v0.2.4-master","## 变更内容\n* 修复自定义表型并使其更加健壮，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F350 中完成\n* 将 PyTorch 更新至 2.7.1+cu128，以支持 RTX 50 系列 GPU，由 @MiggiV2 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F354 中完成\n* 减小 Docker 镜像体积，由 @faltiska 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F361 中完成\n* 使用 PyTorch 2.8 以兼容 50 系列显卡，由 @garciadias 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F390 中完成\n* 新特性：添加可配置的日志级别，并支持环境变量，由 @ryan-steed-usa 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F404 中完成\n* 修复（CPU\u002FDocker）：为 appuser 安装 Rust、设置 PATH，并延长 uv 超时时间以稳定构建，由 @nRanzo 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F383 中完成\n* 构建：添加 CMake 以修复 pyopenjtalk 依赖，并使 CI 依赖与 Docker 保持同步，由 @ryan-steed-usa 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F412 中完成\n* 在 `start-gpu.sh` 中使用 `#!\u002Fusr\u002Fbin\u002Fenv bash` 以提高兼容性，由 @basnijholt 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F419 中完成\n* 构建：添加支持，可通过 GitHub Action 环境变量覆盖 docker-bake.hcl 变量，由 @ryan-steed-usa 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F413 中完成\n* PR 420，由 @remsky 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F429 中完成\n* 通过并行化各个 Docker 目标来缩短构建时间，由 @kprinssu 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F420 中完成\n\n## 新贡献者\n* @MiggiV2 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F354 中完成了首次贡献\n* @faltiska 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F361 中完成了首次贡献\n* @garciadias 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F390 中完成了首次贡献\n* @ryan-steed-usa 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F404 中完成了首次贡献\n* @nRanzo 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F383 中完成了首次贡献\n* @basnijholt 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F419 中完成了首次贡献\n* @kprinssu 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F420 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.2.4...v0.2.4-master","2025-12-13T23:31:25",{"id":187,"version":188,"summary_zh":189,"released_at":190},351717,"v0.2.4","## 变更内容\n* 文档：@FotieMConstant 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F232 中为 Apple Silicon 用户添加了关于 GPU 构建的说明。\n* 将 api\u002Fsrc\u002Fstructures\u002Fcustom_responses.py 中的 CRLF 结尾行转换为 LF 结尾行，由 @blakkd 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F199 中完成。\n* 修复与功能更新，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F235 中完成。\n* 添加直接支持 Windows 的脚本，由 @kimnzl 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F241 中完成。\n* 增加对 Apple Silicon 上 MPS 的支持，由 @rampadc 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F233 中完成。\n* 使用本地 JS 文件代替 unpkg CDN，由 @mpnsk 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F244 中完成。\n* 修复在流式传输关闭且 return_download_link 为 true 时未返回下载链接的问题，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F240 中完成。\n* 段错误修复，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F253 中完成。\n* 与货币解析及测试相关的修复。此外还有 README 相关内容的更新，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F256 中完成。\n* 修复 Helm Chart 的健康检查、Ingress 和 values 配置，由 @richardr1126 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F257 中完成。\n* start-gpu_mac.sh：移除重复的环境变量，并与其他 Shell 脚本保持一致，由 @rampadc 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F266 中完成。\n* 维护与自动化工作，由 @remsky 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F276 中完成。\n* 更新 Dockerfile 以安装 Rust，由 @RigleGit 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F291 中完成。\n* 修复归一化问题，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F303 中完成。\n* 修复表型相关问题，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F304 中完成。\n* 为带字幕的语音添加了一些更完善的安全检查，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F310 中完成。\n* 功能（文本）：添加基于中文标点符号的句子拆分功能，以改善…，由 @jiaohuix 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F321 中完成。\n* 改进音频暂停处理、MP3 编码以及鲁棒的文本归一化\u002F拆分功能，由 @mylukin 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F322 中完成。\n* 更新 paths.py 文件，由 @mbailey 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F311 中完成。\n* 添加音量倍增器设置，由 @JCallicoat 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F316 中完成。\n* 发布版本，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F339 中完成。\n\n## 新贡献者\n* @FotieMConstant 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F232 中完成了首次贡献。\n* @blakkd 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F199 中完成了首次贡献。\n* @kimnzl 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F241 中完成了首次贡献。\n* @rampadc 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F233 中完成了首次贡献。\n* @mpnsk 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F244 中完成了首次贡献。\n* @RigleGit 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F2 中完成了首次贡献。","2025-06-18T22:27:55",{"id":192,"version":193,"summary_zh":194,"released_at":195},351718,"v0.2.3","## 变更内容\n* 禁用 Unicorn\u002FFastAPI 的 `--reload` 选项，以避免占用一个 CPU 核心，由 @randombk 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F171 中完成\n* 添加 `.gitattributes` 文件，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F186 中完成\n* 规范化相关更改，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F179 中完成\n* 流式输出单词时间戳，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F173 中完成\n* 修复因音频以较低比特率编码而导致的低质量问题，由 @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F207 中完成\n\n## 新贡献者\n* @randombk 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F171 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.2.2...v0.2.3pre","2025-03-07T05:26:31",{"id":197,"version":198,"summary_zh":199,"released_at":200},351719,"v0.2.2","## 修复\n* 在 CPU 镜像中作为回退方案时，语音合成无法可靠触发的问题\n* 通过调整压缩设置提升了音频质量，并修复了 Web UI 格式选择中的 bug\n* 新增高级归一化设置 @fireblade2534\n\n## 变更内容\n* @zucher 添加了 Helm Chart，详见 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F157 和 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F162\n* @fireblade2534 修复了大量问题，详见 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F152\n* @Krurst 添加了基于设置覆盖默认 lang_code 的功能，详见 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F155\n* 文档更新由 @eltociear 完成，详见 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F156\n\n## 新贡献者\n* @zucher 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F157 中完成了首次贡献\n* @Krurst 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F155 中完成了首次贡献\n* @eltociear 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F156 中完成了首次贡献\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.2.1...v0.2.2","2025-02-13T09:49:41",{"id":202,"version":203,"summary_zh":204,"released_at":205},351720,"v0.2.1","## 变更内容\n\n* 调整以提高与 espeak-loader 依赖 misaki 的兼容性 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F127\n* 添加 v1\u002Fmodels 占位端点以实现兼容性 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F144\n* 修复字幕重复的问题，改为在音频流上生成字幕文件，并在下载完成后使用临时文件保存 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fissues\u002F139\n* @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F131 中修复了构建系统和模型下载系统中的一些问题\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.2.0...v0.2.1","2025-02-10T05:59:21",{"id":207,"version":208,"summary_zh":209,"released_at":210},351721,"v0.2.0","* 模型全面升级：\n   * 升级至 Kokoro v1.0 模型架构，废弃 V0.19 支持\n   * 集成 [hexgrad\u002Fkokoro](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fkokoro) 和 [hexgrad\u002Fmisaki](https:\u002F\u002Fgithub.com\u002Fhexgrad\u002Fmisaki) 两个软件包\n   * 预装了 Misaki 提供的所有多语言支持：\n      * 英语 (en)、日语 (ja)、韩语 (ko)、中文 (zh)、越南语 (vi)\n      * 注：未来版本中这可能会通过环境变量来控制\n   * 包含所有支持语言的语音包，并保留原始版本\n* 音频生成功能增强：\n   * 按词粒度生成带时间戳的字幕\n   * 支持音素生成及基于音素的音频生成（Token 数量上限为 510）\n* Web UI 改进：\n   * 加权语音混合\n   * 支持文本文件上传\n   * 改进了文本编辑器，并对用户界面进行了调整\n\n变更内容\n* Combine Voices 端点现在返回 .pt 文件，其他情况下则会实时生成组合结果\n* 将 PyTorch 版本升级至 2.6.0，CUDA 升级至 12.4\n* 调整了 Docker 工作流，并引入 Docker Bake\n\n贡献者\n* @fireblade2534\n* @eschmidbauer\n* @jteijema \n* @dino65-dev\n* @Galunid\n* @JoshRosen\n* @richardr1126\n\n**完整更新日志**：v0.1.4...v0.2.0\n```","2025-02-07T11:23:29",{"id":212,"version":213,"summary_zh":214,"released_at":215},351722,"v0.1.4","- 用于简化流式传输\u002F异步推理流程的改动仍在进行中。\n- 新增了WebUI，作为Gradio UI的轻量级替代方案。\n- 更多配置变量已被公开，包括临时文件管理设置。\n- 添加了用于系统和存储信息（线程、会话等）的新调试端点。\n- 进行了大规模的重构，以支持并发处理、解耦推理工作流，从而提供更高的灵活性。\n\n## 变更内容\n* @jteijema 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F50 中更新了README.md，添加了新的本地端点使用示例。\n* @jteijema 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F51 中更新了UI访问方式，加入了环境URL和PORT。\n* @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F69 中修复了Python测试。\n* @richardr1126 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F74 中尝试添加AAC音频格式，并更新了相关测试。\n* @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F87 中修复了因E-speak后端过多而导致的线程泄漏问题。\n* @JoshRosen 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F94 中修复了流式WAV响应中的播放截断问题。\n* @fireblade2534 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F99 中修复了模型自动下载功能。\n* @remsky 发布了V0.1.4版本，详情见 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F102。\n* @remsky 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F104 中对CI进行了更新。\n\n## 新贡献者\n* @jteijema 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F50 中完成了首次贡献。\n* @richardr1126 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F74 中完成了首次贡献。\n* @JoshRosen 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F94 中完成了首次贡献。\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.1.0...v0.1.4","2025-01-31T09:06:30",{"id":217,"version":218,"summary_zh":219,"released_at":220},351723,"v0.1.0","## 变更内容\n------------------------------------------\n* _可能破坏性变更_\n    - 从 pip 切换到 `uv` 进行依赖管理\n    - 将模型文件和语音包直接打包进 GPU 和 CPU 镜像中\n    - `latest-slim` 标签仍需社区测试，但我们将在部署时持续优化并验证其可用性\n    - Dockerfile 和 Docker Compose 文件的位置已移至 `docker` 目录。启动时请务必检查路径\n------------------------------------------\n* UI 变更：\n    - 启用了多选和语音合并功能。\n    - 设置了一个环境变量来禁用本地保存和文件路径操作。默认情况下，本地保存功能仍然启用。\n    - 将波形图的颜色改为动态蓝色。\n\n* API 变更\n    - 简化了音频归一化处理，稳定性更高（作为最终用户可能不会察觉到明显差异）。\n    - 流式传输现在会正确处理连接中断情况，在遇到下一段数据时会停止处理。\n    - 对 GPU 内存的管理进行了小幅至中等程度的清理，并增加了多项安全措施（例如清除中间张量、添加显存压力警告等）。\n\n* CI\u002FCD 已在 GitHub Actions 上线\n    - 现在每次提交 Pull Request 时，都会运行所有 API 测试。您可以根据新功能调整这些测试用例，并按需添加新的测试，但请尽量不要降低代码覆盖率，这样能让我工作起来更轻松一些。\n    - 大部分 PyTorch 模拟对象已被移除，自动化测试将基于 CPU 版本运行。\n\n-----------------------------------------\n\n与这个模型合作非常愉快。期待由 https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M 发布的新版 0.24 模型。\n\n请务必关注他们的页面，以获取模型开发的最新动态，同时请注意他们一直在寻找更多训练数据。\n\n----------------------------------------\n\n## 新贡献者\n* @Galunid 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F32 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.5...v0.1.0","2025-01-14T15:25:52",{"id":222,"version":223,"summary_zh":224,"released_at":225},351724,"v0.0.5post1","## 变更内容\n* 修复：添加缺失的健康检查依赖（curl），由 @Galunid 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F32 中完成\n* 微小的 Docker 标签和配置更改\n* 修复 Gradio 和 GPU 内存管理相关 bug\n\n\n* _附赠语音包_ `af_irulan`：将其拖放至你的 api\u002Fvoices 文件夹中\n\n## 新贡献者\n* @Galunid 在 https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F32 中完成了首次贡献\n\n**完整变更日志**：https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.5...v0.0.5post1","2025-01-13T06:46:15",{"id":227,"version":228,"summary_zh":229,"released_at":230},351725,"v0.1.0-pre","- 初步将依赖管理切换至 `uv`，以简化测试和部署流程\n- 移除 `model-fetcher` 容器，并将模型直接打包到 Docker 镜像中\n- 统一镜像标签策略，确保在不同架构上都能一致使用 `latest` 标签\n- 进行了一些细微的结构调整，以便支持即将引入的自定义语音混音模块\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.5...v0.1.0-pre","2025-01-12T13:47:31",{"id":232,"version":233,"summary_zh":234,"released_at":235},351726,"v0.0.5","- Stabilized issues with images tagging and structures from v0.0.4\r\n- Added automatic master to develop branch synchronization\r\n- Improved release tagging and structures\r\n- Initial CI\u002FCD setup\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.4...v0.0.5","2025-01-11T05:20:28",{"id":237,"version":238,"summary_zh":239,"released_at":240},351727,"v0.0.4","## What's Changed\n* Update README.md by @fireblade2534 in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F14\n* Fix url parsing for urls without https, http, or www by @fireblade2534 in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F12\n* - Added phoneme-centric endpoints by @remsky in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F17\n\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.3...v0.0.4","2025-01-09T20:24:52",{"id":242,"version":243,"summary_zh":244,"released_at":245},351728,"v0.0.3","## What's Changed\n* Feat\u002Fstreaming by @remsky in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F9\n* Make urls readable by @fireblade2534 in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F10\n\n## New Contributors\n* @fireblade2534 made their first contribution in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F10\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.2...v0.0.3","2025-01-07T11:50:04",{"id":247,"version":248,"summary_zh":249,"released_at":250},351729,"v0.0.2","## What's Changed\n* Enhance Audio Converter by @dino65-dev in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F6\n* Feat\u002Fonnx inference by @remsky in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F7\n\n## New Contributors\n* @dino65-dev made their first contribution in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F6\n\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcompare\u002Fv0.0.1...v0.0.2","2025-01-04T10:06:43",{"id":252,"version":253,"summary_zh":254,"released_at":255},351730,"v0.0.1","## What's Changed\r\n* add speed by @eschmidbauer in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F1\r\n* add ability to combine voices by @eschmidbauer in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F2\r\n* Feat\u002Fgradio gui by @remsky in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F4\r\n\r\n## New Contributors\r\n* @eschmidbauer made their first contribution in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F1\r\n* @remsky made their first contribution in https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fpull\u002F4\r\n\r\n**Full Changelog**: https:\u002F\u002Fgithub.com\u002Fremsky\u002FKokoro-FastAPI\u002Fcommits\u002Fv0.0.1\r\n\r\n\r\n\r\n\u003Cdiv align=\"center\">\r\n\r\n----------------------------------------------------------------------------\r\n\r\n-- Updated: Jan 11 '2025 --\r\n\r\n_Attaching the source models trained and created by `hexgrad\u002FKokoro-82M` as binaries, to stabilize this repo. Check out their page and give a like or join the discord, they're continuing to do great work_\r\n\r\n[![Model on HF](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fhuggingface\u002Fbadges\u002Fresolve\u002Fmain\u002Fmodel-on-hf-md-dark.svg)](https:\u002F\u002Fhuggingface.co\u002Fhexgrad\u002FKokoro-82M)\r\n\u003C\u002Fdiv>","2025-01-02T09:25:46"]