OpenRouter详解Python语音智能体构建
OpenRouter发布Python教程,用一个OpenRouter API密钥串联语音转文本、带工具调用的LLM和流式文本转语音,构建餐厅订位语音智能体。示例采用Scribe v2、GPT-6 Luna和Eleven Flash v2.5,在模型生成完整回复前就将已完成句子送入语音合成。OpenRouter称,三段测试对话共12轮的服务端首段音频延迟中位数为1.9秒,文本转语音约占模型成本的90%。
该教程为开发者连接语音转录、工具型LLM和语音合成提供了完整架构与实现范式,并附带可参考的延迟和成本测量。
How to Build a Voice AI Agent
OpenRouter ·11/10/2026


A voice agent needs to do more than generate a good answer. It must understand what someone said, decide what to do, call any needed tools, and start speaking again before the pause gets awkward.
In this tutorial, we’ll build that full loop in Python. Our example is a restaurant booking agent that transcribes a caller, checks table availability with tools, and turns the response back into speech. Speech-to-text, the LLM, and text-to-speech all run through one OpenRouter API key, and we stream each completed sentence to TTS instead of waiting for the entire reply.
#OpenRouter#LiveKit#ElevenLabs Scribe v2#GPT-6 Luna#ElevenLabs Eleven Flash v2.5