{"id":22413409,"url":"https://github.com/rokid/rokid-openvoice-websocket","last_synced_at":"2026-02-05T18:31:11.928Z","repository":{"id":95053150,"uuid":"90828207","full_name":"rokid/rokid-openvoice-websocket","owner":"rokid","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-13T08:00:56.000Z","size":94,"stargazers_count":5,"open_issues_count":0,"forks_count":3,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-07-11T05:35:49.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/rokid.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":"2017-05-10T06:22:41.000Z","updated_at":"2023-05-02T08:18:09.000Z","dependencies_parsed_at":"2023-04-28T12:03:50.795Z","dependency_job_id":null,"html_url":"https://github.com/rokid/rokid-openvoice-websocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rokid/rokid-openvoice-websocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rokid%2Frokid-openvoice-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rokid%2Frokid-openvoice-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rokid%2Frokid-openvoice-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rokid%2Frokid-openvoice-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rokid","download_url":"https://codeload.github.com/rokid/rokid-openvoice-websocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rokid%2Frokid-openvoice-websocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29128684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T18:31:02.507Z","status":"ssl_error","status_checked_at":"2026-02-05T18:29:43.962Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-05T14:12:47.138Z","updated_at":"2026-02-05T18:31:11.911Z","avatar_url":"https://github.com/rokid.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# rokid-openvoice-websocket\n## 开放平台接口定义文档(websocket版)\n\n\u003e 文档版本:V0.2\n\nRokid openvoice开放服务(websocket版)包含以下三部分功能，\n\n- 设备认证\n- 自然语言合成（TTS）\n- 完整语音交互(SPCH)\n\n## 文档简介\n\n此文档用于定义开放平台上云端应用接口开发协议，协议遵循 [websocket](https://zh.wikipedia.org/zh-cn/WebSocket) 协议。\n\n## Speech 接口\n\n### 服务器地址\n[wss://apigwws.open.rokid.com/api](wss://apigwws.open.rokid.com/api)\n\n### protobuf 定义\n详见[protobuf](https://github.com/Rokid/rokid-openvoice-websocket/tree/master/protobuf)\n\n### AuthRequest\n\n\n| 参数             | 类型     | 描述                     | 默认值  |\n| -------------- | ------ | ---------------------- | ---- |\n| key            | string | 开放接口Key,在管理平台获取        | 无，必填 |\n| device_type_id | string | 设备类型ID                 | 无，必填 |\n| device_id      | string | 设备ID                   | 无，必填 |\n| service        | string | asr,tts,speech            | 无，必填 |\n| version        | string | 接口版本号                  | 无，必填 |\n| timestamp      | string | unix时间戳                | 无，必填 |\n| sign           | string | 由以上几项+secret按约定的加密方式生成 | 无，必填 |\n\nsign的生成加密方式：\n\nkey={key}\u0026device_type_id={device_type_id}\u0026device_id={device_id}\u0026service={service}\u0026version={version}\u0026time={timestamp}\u0026secret={secret}\n\n的utf8字符串的md5值\n\n其中{xxx}由xxx的值替代\n\nkey及secret由开发方通过管理平台获取，并保管。\n\n此处version可有1.0或2.0，分别对应protobuf中v1或v2目录。\n\n### AuthResponse\n\n请求响应\n\n| 参数     | 类型    | 描述                |\n| ------ | ----- | ----------------- |\n| result | int32 | 认证结果(成功:0, 失败:-1) |\n\n### TtsRequest\n\nPCM格式为 RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 24000 Hz语音。\n注意，这里的PCM与Asr的PCM格式不一致，因此不能将tts的输出直接作为asr的输入。\n可以使用 sox -t s16 -c 1 -r 24000 xxx.pcm xxx.wav 将pcm转成wav。\n\n或者\n\n请求时将 sample_rate 设置为16000，则返回16k的语音数据，可以直接作为asr的输入。\n\n| 参数     | 类型        | 描述                   | 默认值  |\n| ------ | --------- | -------------------- | ---- |\n| id        | int32  | 唯一标识，用于跟踪一个完整的请求，处理及响应事件。   | 0    |\n| text   | string    | 需要转换的text文本          | 无    |\n| declaimer | string | 发音者，如\"zh\",\"zhangsan\",\"rose\" | \"zh\" |\n| codec     | string | 语音流的编码，目前支持PCM，OPU，OPU2。    | 无  |\n| sample_rate     | uint32 | 语音流的比特率，目前支持24000，16000。    | 24000  |\n\n### TtsResponse\n\n请求响应\n\n| 参数    | 类型     | 描述            |\n| ----- | ------ | ------------- |\n| id        | int32  | 唯一标识，用于跟踪一个完整的请求，处理及响应事件。   |\n| result  | SpeechErrorCode | 错误信息 |\n| text  | string | voice语音中包含的文字 |\n| voice | bytes  | 合成的voice语音    |\n| finish   | bool | 语音是否结束 |\n\n### SpeechRequest\n\nPCM格式为 RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz语音。 \n注意，这里的PCM与Tts的PCM格式不一致，因此不能将tts的输出直接作为asr的输入。\n可以使用 sox -t s16 -c 1 -r 16000 xxx.pcm xxx.wav 将pcm转成wav。\n\n| 参数     | 类型        | 描述                   | 默认值  |\n| ------ | --------- | -------------------- | ---- |\n| id      | int32  | 唯一标识，用于跟踪一个完整的请求，处理及响应事件。 | 0     |\n| type   | ReqType | START/VOICE/END 或 TEXT | 无   |\n| voice  | bytes     | 需要识别的voice语音流        | 无    |\n| asr    | bytes     | 需要理解的asr文本        | 无    |\n| options    | SpeechOptions     | 辅助理解的选项        | 无    |\n| lang    | string | 语音流的语言，目前支持zh-CN，en-US。   | zh-CN |\n| codec   | string | 语音流的编码，目前支持PCM，OPU，OPU2。  | PCM   |\n| vad_mode   | VadMode | LOCAL/CLOUD  | 无   |\n| vend_timeout   | uint32 | 如果vad_mode为CLOUD时，指定vad时间，单位ms  | 无   |\n| no_nlp   | bool | 是否需要nlp  | false   |\n| no_intermediate_asr   | bool | 是否需要asr的实时识别结果  | false   |\n| stack   | string | 设备当前的应用栈信息,\"appid1:appid2\"按照应用被调用的早晚逆序排列。              | 空     |\n| voice_trigger      | string | 激活词，即用于唤醒设备的名字，如\"若琪\"。     | 空     |\n| voice_power   | float | 语音流的音强  | 如有进行多设备间的仲裁   |\n| trigger_start   | float | 语音流的激活词的开始位置。  | 无   |\n| trigger_length   | float | 语音流的激活词的长度。  | 无   |\n| skill_options  | string | 设备上的状态信息，为json结构，此结构会传给相应的skill的cloud app中。         | 空     |\n| voice_extra  | string | 设备上的语言的额外信息，为json结构，此结构会传给asr中。         | 空     |\n| vad_begin  | uint32 | asr会将语音从 vad_begin ms开始识别，之前的数据丢弃。         | 0     |\n\n### SpeechResponse\n\n| 参数     | 类型     | 描述             |\n| ------ | ------ | -------------- |\n| id      | int32  | 唯一标识，用于跟踪一个完整的请求，处理及响应事件。 |\n| result  | SpeechErrorCode | 错误信息 |\n| type  | RespType | 结果类型INTERMEDIATE/ASR_FINISH/FINISH |\n| asr    | string | asr实时识别的结果     |\n| nlp    | string | nlp识别的结果       |\n| action | string | cloud app处理的结果 |\n| extra | string | 目前有：{\"activation\": \"fake(误激活)|reject(仲裁失败)|accept(激活确认)|none(无激活词时)\"} |\n\naction：json字符串，结构详见 [action定义](https://github.com/Rokid/docs/blob/master/2-RokidDocument/1-SkillsKit/Cloud%20App%20Development%20Protocol_cn.md#32-action%E5%AE%9A%E4%B9%89)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frokid%2Frokid-openvoice-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frokid%2Frokid-openvoice-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frokid%2Frokid-openvoice-websocket/lists"}