Skip to main content
Custom hotwords

Custom hotwords HTTP API

Manage custom vocabularies through HTTP APIs, including creating, listing, getting, updating, and deleting vocabularies.

User guide: Custom hotwords.

Prerequisites

  • An API key configured as the DASHSCOPE_API_KEY environment variable

Endpoint

POST https://dashscope-intl.aliyuncs.com/api/v1/services/audio/asr/customization

Request headers

ParameterTypeRequiredDescription
AuthorizationstringYesBearer token. Format: Bearer $DASHSCOPE_API_KEY.
Content-TypestringYesMedia type of the request body. Set to application/json.

Create a vocabulary

Request body

ParameterTypeRequiredDescription
modelstringYesThe custom vocabulary model. Set to speech-biasing.
inputobjectYesThe input parameters. See below.

Response body

ParameterTypeDescription
request_idstringThe unique identifier of this request.
outputobjectThe response data.
output.vocabulary_idstringThe ID of the created vocabulary.
usageobjectUsage information.
usage.countintegerThe number of vocabularies created. Always 1.

List vocabularies

Request body

ParameterTypeRequiredDescription
modelstringYesSet to speech-biasing.
inputobjectYesThe input parameters. See below.

Response body

ParameterTypeDescription
request_idstringThe unique identifier of this request.
outputobjectThe response data.
output.vocabulary_listarray[object]The queried vocabularies.
usageobjectUsage information.
usage.countintegerAlways 1.
Each item in vocabulary_list contains:
FieldTypeDescription
vocabulary_idstringThe vocabulary ID.
gmt_createstringThe creation time.
gmt_modifiedstringThe last modification time.
statusstringOK: Ready. UNDEPLOYED: Not available.

Get a vocabulary

Request body

ParameterTypeRequiredDescription
modelstringYesSet to speech-biasing.
inputobjectYesThe input parameters. See below.

Response body

ParameterTypeDescription
request_idstringThe unique identifier of this request.
outputobjectThe response data.
usageobjectUsage information.
usage.countintegerAlways 1.
The output object contains:
FieldTypeDescription
gmt_createstringThe creation time.
gmt_modifiedstringThe last modification time.
statusstringOK: Ready. UNDEPLOYED: Not available.
target_modelstringThe speech recognition model that uses this vocabulary.
vocabularyarray[object]The vocabulary entries. See Hotword entry structure.

Update a vocabulary

Request body

ParameterTypeRequiredDescription
modelstringYesSet to speech-biasing.
inputobjectYesThe input parameters. See below.

Response body

ParameterTypeDescription
request_idstringThe unique identifier of this request.
outputobjectThe response data. Always empty.
usageobjectUsage information.
usage.countintegerThe number of vocabularies updated. Always 1.

Delete a vocabulary

Request body

ParameterTypeRequiredDescription
modelstringYesSet to speech-biasing.
inputobjectYesThe input parameters. See below.

Response body

ParameterTypeDescription
request_idstringThe unique identifier of this request.
outputobjectThe response data. Always empty.
usageobjectUsage information.
usage.countintegerThe number of vocabularies deleted. Always 1.

Hotword entry structure

Each entry in the vocabulary array has the following fields:
FieldTypeRequiredDescription
textstringYesThe 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.
weightintegerYesThe 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.
langstringNoThe 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).