Manage custom vocabularies through HTTP APIs, including creating, listing, getting, updating, and deleting vocabularies.
User guide: Custom hotwords.
Each item in
The
Each entry in the
Prerequisites
- An API key configured as the
DASHSCOPE_API_KEYenvironment variable
Endpoint
Request headers
| Parameter | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token. Format: Bearer $DASHSCOPE_API_KEY. |
| Content-Type | string | Yes | Media type of the request body. Set to application/json. |
Create a vocabulary
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | The custom vocabulary model. Set to speech-biasing. |
| input | object | Yes | The input parameters. See below. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The response data. |
| output.vocabulary_id | string | The ID of the created vocabulary. |
| usage | object | Usage information. |
| usage.count | integer | The number of vocabularies created. Always 1. |
List vocabularies
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Set to speech-biasing. |
| input | object | Yes | The input parameters. See below. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The response data. |
| output.vocabulary_list | array[object] | The queried vocabularies. |
| usage | object | Usage information. |
| usage.count | integer | Always 1. |
vocabulary_list contains:
| Field | Type | Description |
|---|---|---|
| vocabulary_id | string | The vocabulary ID. |
| gmt_create | string | The creation time. |
| gmt_modified | string | The last modification time. |
| status | string | OK: Ready. UNDEPLOYED: Not available. |
Get a vocabulary
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Set to speech-biasing. |
| input | object | Yes | The input parameters. See below. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The response data. |
| usage | object | Usage information. |
| usage.count | integer | Always 1. |
output object contains:
| Field | Type | Description |
|---|---|---|
| gmt_create | string | The creation time. |
| gmt_modified | string | The last modification time. |
| status | string | OK: Ready. UNDEPLOYED: Not available. |
| target_model | string | The speech recognition model that uses this vocabulary. |
| vocabulary | array[object] | The vocabulary entries. See Hotword entry structure. |
Update a vocabulary
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Set to speech-biasing. |
| input | object | Yes | The input parameters. See below. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The response data. Always empty. |
| usage | object | Usage information. |
| usage.count | integer | The number of vocabularies updated. Always 1. |
Delete a vocabulary
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Set to speech-biasing. |
| input | object | Yes | The input parameters. See below. |
Response body
| Parameter | Type | Description |
|---|---|---|
| request_id | string | The unique identifier of this request. |
| output | object | The response data. Always empty. |
| usage | object | Usage information. |
| usage.count | integer | The number of vocabularies deleted. Always 1. |
Hotword entry structure
Each entry in the vocabulary array has the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | The vocabulary entry text. The text language must be supported by the selected model. Use actual words rather than arbitrary character combinations. Maximum length: 15 characters for text that includes non-ASCII characters, or 7 space-separated words for ASCII-only text. |
| weight | integer | Yes | The vocabulary entry weight. Recommended value: 4. Valid values: 1 to 5. If recognition accuracy doesn't improve, increase the weight. An excessively high weight may reduce the recognition accuracy of other words. |
| lang | string | No | The language code of the audio to be recognized. When set, the system improves recognition of vocabulary entries in the specified language. If you can't determine the language in advance, leave this parameter unset. Valid values vary by model. Fun-ASR: zh (Chinese), en (English), ja (Japanese). |