用途
iblai-api-agent-voice 用于通过 ibl.ai 平台 API 配置智能体“如何说话、如何听”。所有字段的作用范围是单个智能体,即对该智能体的每位用户生效。有界面的 /iblai-vibe-agent-voice(Voice 标签页)和 /iblai-vibe-agent-screenshare(Screen 标签页)挂载同一份数据,本技能是它们可脚本化的无界面版本。
主要能力
语音配置存放在两类资源中:
- 智能体设置(…/mentors/{mentor}/settings/):聊天语音(voice_provider 与 openai_voice / google_voice / iblai_voice)、voice_instructions、transcription_language、transcription_instructions,以及 show_voice_call / show_voice_record 开关。
- 通话配置(…/call-configurations/,每个智能体一行):通话风格、语言、AI 提供商、通话语音、屏幕共享(enable_video 与两个提示词)。
读取接口包括:
- GET …/mentors/{mentor}/settings/:返回当前语音字段,并内嵌该智能体的 call_configuration 对象(该对象不为 null,但在尚未通过 POST 创建时其 id 为 null,因此应先执行 POST)。语音字段返回的是语音名称(如 "alloy"),而非 id。
- GET …/voices/:语音目录,支持 provider(browser | openai | google | iblai | elevenlabs)、search、page、page_size、ordering 查询参数;每条返回 { id, name, provider, language, description, audio_url },audio_url 是可播放的示例。
- GET …/voices/{id}/:获取单个语音。
- GET …/call-configurations/?mentor={mentor}:返回该智能体的通话配置数组(取第一项);也可按 mode、search、ordering 过滤。
- GET …/call-configurations/{id}/:获取单条通话配置。
写入接口包括:
- PUT …/mentors/{mentor}/settings/:以 multipart/form-data 提交,只发送需要改动的键;字段包括 voice_provider、openai_voice、google_voice、iblai_voice、voice_instructions、transcription_language、transcription_instructions、show_voice_call、show_voice_record。voice_provider 决定哪个 *_voice 字段生效;browser 使用听者设备,无需语音 id。voice_instructions 会以语音指令形式传给 OpenAI,以合成提示词形式传给 Google,其它提供商忽略它。
- POST …/call-configurations/:仅在 GET 未返回任何记录时创建该智能体的通话配置;字段包括 mentor(uuid,必填)、mode(realtime | inference)、language、llm_provider、tts_provider、stt_provider、openai_voice_id、google_voice_id、use_function_calling_for_rag、enable_video、screensharing_system_prompt、screensharing_proactive_prompt。
- PATCH …/call-configurations/{id}/:修改上述任意字段(只发变更键)。
- PUT …/call-configurations/{id}/:替换整行(需一并发送 mentor)。
- 通话配置没有 DELETE。
使用方式
请求约定:
- 基础 URL:https://api.iblai.app
- 每个请求都带请求头 Authorization: Api-Token $IBLAI_API_KEY。
- 路径变量中,{org} = $IBLAI_ORG、{username} = $IBLAI_USERNAME、{mentor} = 智能体唯一 id。
- 所有路径以 https://api.iblai.app/dm/api/ai-mentor/orgs/{org}/users/{username} 为前缀。
- 通话配置仅组织管理员可写。
- 若尚未连接,先运行 /iblai-api-login 以填充 IBLAI_ORG、IBLAI_USERNAME 和 IBLAI_API_KEY。
示例(对已有通话配置的智能体开启屏幕共享并设置开场白):
API="https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME"
ID=$(curl -s "$API/call-configurations/?mentor=$MENTOR"
-H "Authorization: Api-Token $IBLAI_API_KEY" | jq '.[0].id')
curl -X PATCH "$API/call-configurations/$ID/"
-H "Authorization: Api-Token $IBLAI_API_KEY"
-H "Content-Type: application/json"
-d '{"enable_video": true, "screensharing_proactive_prompt": "I can see your screen now. What would you like help with first?"}'
适用场景
- 为智能体选择并切换聊天语音(浏览器设备语音、OpenAI、Google、ibl.ai)。
- 设置语音风格指令、转写语言与转写术语提示。
- 开关语音通话和听写麦克风。
- 管理实时通话或推理模式下的 LLM/TTS/STT 提供商与通话语音。
- 在实时模式下启用屏幕共享并配置屏幕共享提示词。
- 以脚本方式批量核对或调整智能体语音配置。
限制与注意事项
- 接口依据 2026-10-02 在线 schema(https://api.iblai.app/dm/api/docs/schema/,版本 4.411.0)核对。
- 名称出、id 入:设置接口返回语音名称,写入接口接收语音 id;可用 GET …/voices/?provider=<p>&search=<name> 解析名称。
- 缺席即不变:设置 PUT 中未出现的字段保持不变。清空 voice_instructions / transcription_instructions 用 "",不要用 null。
- iblai_voice 不能清空:传 "" 会返回 400,传 0 或空值不产生变化。
- transcription_language 使用 ISO 639-1(如 "es"),"" 表示自动检测。
- 屏幕共享需要实时通话:enable_video 仅在 realtime 模式下、且 show_voice_call 开启时生效。
- 新建通话配置的 screensharing_system_prompt 默认填入平台的屏幕指导文本。
- 非空 voice_instructions 会使 OpenAI 合成切换到支持指令的模型,成本更高。
- 通话配置无删除接口;创建前需先确认 GET 无记录。