Models - Create

Creates a new voice model.

PUT {endpoint}/customvoice/models/{id}?api-version=2024-02-01-preview

URI Parameters

Name In Required Type Description
endpoint
path True

string

Supported Cognitive Services endpoints (protocol and hostname, for example: https://eastus.api.cognitive.microsoft.com).

id
path True

string

The ID of the resource.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{1,62}[a-zA-Z0-9]$

api-version
query True

string

The API version to use for this operation.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

Provide your Speech resource key here.

Operation-Id

string

ID of the status monitor for the operation. If the Operation-Id header matches an existing operation and the request is not identical to the prior request, it will fail with a 400 Bad Request.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._-]{1,62}[a-zA-Z0-9]$

Request Body

Name Required Type Description
consentId True

string

Resource id

projectId True

string

Resource id

recipe True

Recipe

Recipe for model building. Different recipes have different capability.

trainingSetId True

string

Resource id

description

string

Model description

id

string

Resource id

locale

string

The locale of this model. Locale code follows BCP-47. You can find the text to speech locale list here https://learn.microsoft.com/azure/ai-services/speech-service/language-support?tabs=tts.

properties

ModelProperties

Model properties

status

Status

Status of a resource.

voiceName

string

Voice name

Responses

Name Type Description
201 Created

Model

Created

Headers

  • Operation-Id: string
  • Operation-Location: string
Other Status Codes

ErrorResponse

An error occurred.

Headers

x-ms-error-code: string

Security

Ocp-Apim-Subscription-Key

Provide your Speech resource key here.

Type: apiKey
In: header

Examples

Create a model
Create a multi style model

Create a model

Sample request

PUT {endpoint}/customvoice/models/Jessica?api-version=2024-02-01-preview



{
  "voiceName": "JessicaNeural",
  "description": "Jessica voice",
  "recipe": {
    "kind": "Default"
  },
  "projectId": "Jessica",
  "consentId": "Jessica",
  "trainingSetId": "Jessica-300"
}

Sample response

Operation-Location: https://eastus.api.cognitive.microsoft.com/customvoice/operations/1f4352df-f247-40c0-a7b1-a54d017933e1?api-version=2024-02-01-preview
Operation-Id: 1f4352df-f247-40c0-a7b1-a54d017933e1
{
  "id": "Jessica",
  "voiceName": "JessicaNeural",
  "description": "Jessica voice",
  "recipe": {
    "kind": "Default",
    "version": "V7.2023.03"
  },
  "projectId": "Jessica",
  "consentId": "Jessica",
  "trainingSetId": "Jessica-300",
  "locale": "en-US",
  "engineVersion": "2023.07.04.0",
  "status": "NotStarted",
  "createdDateTime": "2023-04-01T05:30:00.000Z",
  "lastActionDateTime": "2023-04-02T10:15:30.000Z"
}

Create a multi style model

Sample request

PUT {endpoint}/customvoice/models/JessicaMultiStyle?api-version=2024-02-01-preview



{
  "voiceName": "JessicaMultiStyleNeural",
  "description": "Jessica multi style voice",
  "recipe": {
    "kind": "MultiStyle"
  },
  "projectId": "Jessica",
  "consentId": "Jessica",
  "trainingSetId": "Jessica-300",
  "locale": "en-US",
  "properties": {
    "presetStyles": [
      "cheerful",
      "sad"
    ],
    "styleTrainingSetIds": {
      "happy": "JessicaHappy-300",
      "myStyle2": "JessicaStyle2"
    }
  }
}

Sample response

Operation-Location: https://eastus.api.cognitive.microsoft.com/customvoice/operations/a01a127a-c204-4e46-a8c1-fab01559b05b?api-version=2024-02-01-preview
Operation-Id: a01a127a-c204-4e46-a8c1-fab01559b05b
{
  "id": "JessicaMultiStyle",
  "voiceName": "JessicaMultiStyleNeural",
  "description": "Jessica multi style voice",
  "recipe": {
    "kind": "MultiStyle",
    "version": "V3.2023.06"
  },
  "projectId": "Jessica",
  "consentId": "Jessica",
  "trainingSetId": "Jessica-300",
  "locale": "en-US",
  "engineVersion": "2023.07.04.0",
  "properties": {
    "presetStyles": [
      "cheerful",
      "sad"
    ],
    "styleTrainingSetIds": {
      "happy": "JessicaHappy-300",
      "myStyle2": "JessicaStyle2"
    },
    "voiceStyles": [
      "cheerful",
      "sad",
      "happy",
      "myStyle2"
    ]
  },
  "status": "NotStarted",
  "createdDateTime": "2023-04-01T05:30:00.000Z",
  "lastActionDateTime": "2023-04-02T10:15:30.000Z"
}

Definitions

Name Description
Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

ErrorCode

Top-level error code

ErrorResponse

Error response follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors.

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

Model

Model object

ModelFailureReason

Model training failure reason

ModelProperties

Model properties

PresetStyleItem

Preset styles supported by the recipe. The voice model can support these styles without any style training set.

Recipe

Recipe for model building. Different recipes have different capability.

Status

Status of a resource.

Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

Name Type Description
code

ErrorCode

Top-level error code

details

Error[]

Additional supportive details regarding the error and/or expected policies.

innererror

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

message

string

Top-level error message.

target

string

The source of the error. For example it would be "model" or "model id" in case of invalid model.

ErrorCode

Top-level error code

Name Type Description
BadArgument

string

BadRequest

string

Forbidden

string

InternalServerError

string

NotFound

string

ServiceUnavailable

string

TooManyRequests

string

Unauthorized

string

UnsupportedMediaType

string

ErrorResponse

Error response follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors.

Name Type Description
error

Error

Top-level error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains an top-level error with error code, message, details, target and an inner error with more descriptive details.

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

Name Type Description
code

string

Detailed error code to help diagnostic.

innererror

InnerError

Inner error follows Microsoft Azure REST API Guidelines which is available at https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. This contains required properties error code, message and optional properties target, inner error(this can be nested).

message

string

Detailed error message.

target

string

The source of the error. For example it would be "model" or "model id" in case of invalid model.

Model

Model object

Name Type Description
consentId

string

Resource id

createdDateTime

string

The timestamp when the object was created. The timestamp is encoded as ISO 8601 date and time format ("YYYY-MM-DDThh:mm:ssZ", see https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations).

description

string

Model description

engineVersion

string

Engine version. Update this version can get the latest pronunciation bug fixing.

id

string

Resource id

lastActionDateTime

string

The timestamp when the current status was entered. The timestamp is encoded as ISO 8601 date and time format ("YYYY-MM-DDThh:mm:ssZ", see https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations).

locale

string

The locale of this model. Locale code follows BCP-47. You can find the text to speech locale list here https://learn.microsoft.com/azure/ai-services/speech-service/language-support?tabs=tts.

projectId

string

Resource id

properties

ModelProperties

Model properties

recipe

Recipe

Recipe for model building. Different recipes have different capability.

status

Status

Status of a resource.

trainingSetId

string

Resource id

voiceName

string

Voice name

ModelFailureReason

Model training failure reason

Name Type Description
InaccessibleCustomerStorage

string

The customer uses Bring Your Own Storage in Speech Account. But the storage is not accessible now. Please check doc.

Internal

string

Custom Voice Service error.

SpeakerVerificationFailed

string

The consent and training audio are not from the same speaker.

TerminateByUser

string

The customer canceled model training.

ModelProperties

Model properties

Name Type Description
failureReason

ModelFailureReason

Model training failure reason

presetStyles

string[]

Preset styles of this model.

styleTrainingSetIds

object

Customized styles and associated training sets.

voiceStyles

string[]

All styles supported by this model.

PresetStyleItem

Preset styles supported by the recipe. The voice model can support these styles without any style training set.

Name Type Description
female

string[]

Preset styles supported on female voice model.

male

string[]

Preset styles supported on male voice model.

Recipe

Recipe for model building. Different recipes have different capability.

Name Type Description
datasetLocales

string[]

The locale of the training dataset. Locale code follows BCP-47. You can find the text to speech locale list here https://learn.microsoft.com/azure/ai-services/speech-service/language-support?tabs=tts.

description

string

Recipe description

kind

string

Recipe kind

maxCustomStyleNum

integer

Maximum customized style number supported in one voice model.

minStyleUtteranceCount

integer

Minimum utterance count required to train each customized style.

minUtteranceCount

integer

Minimum utterance count required to train a voice model with this recipe.

modelLocales

string[]

The locale that a voice model can speak with this recipe. Locale code follows BCP-47. You can find the text to speech locale list here https://learn.microsoft.com/azure/ai-services/speech-service/language-support?tabs=tts.

presetStyles

<string,  PresetStyleItem>

Preset styles supported by this recipe per locale. You can get these styles without any style training set.

version

string

Recipe version

Status

Status of a resource.

Name Type Description
Disabled

string

Disabling

string

Failed

string

NotStarted

string

Running

string

Succeeded

string