Skip to main content

Usage Aggregation Tags

Obtaining Usage by Attribute When Sharing the Same Account

When providing a service using AmiVoice API, instead of obtaining separate AmiVoice API accounts for multiple systems, environments, end-users, etc., you may consider sharing a single AmiVoice API account. In such cases, by setting usage aggregation tags for arbitrary attributes, you can obtain AmiVoice API usage for each attribute and utilize it for analysis and other purposes.

Overview

By setting an arbitrary usage aggregation tag (billing_key) in the request parameters when sending a speech recognition request, you can obtain usage for each tag. The usage details CSV that can be checked on the MyPage will be aggregated for each combination of connected engine and usage aggregation tag. For example, if you set tags for each end-user (such as user01, user02, etc.), you can aggregate usage for each end-user and use it for analyzing usage status or calculating the usage amount to be billed to each end-user. Other possible uses include:

  • Aggregating usage for each system when sharing an account across multiple systems (voicebot, transcription, etc.)
  • Aggregating usage for each environment (development, staging, production, etc.)
  • Aggregating usage for each system version (v1, v2, etc.)
  • Aggregating by device used (tel01, tel02, etc.)
note
  • The detailed file is not split for each usage aggregation tag; instead, aggregations for each tag are output within a single file.
  • Tag-specific aggregations cannot be checked in the "Usage of This Month" on the MyPage.

Request Method

The usage aggregation tag billing_key is set within the extension in the request parameters, under client_info. Set any string for billing_key.

Example of extension content:

{
"client_info": {
"billing_key": "any_key_for_billing_aggregation"
}
}

For Synchronous and Asynchronous HTTP Interfaces

Set extension in the d parameter. The value of extension should be URL encoded.

Example of sending a request with the above extension content using the Synchronous HTTP interface:

curl -X POST https://acp-api.amivoice.com/v1/nolog/recognize \
-F u={YOUR_APPKEY} \
-F d="grammarFileNames=-a-general extension=%7B%22client_info%22%3A+%7B%22billing_key%22%3A+%22any_key_for_billing_aggregation%22%7D%7D" \
-F a=@test.wav

For WebSocket Interface

Set extension in the request line of the s command. Escape " in the string set for extension by doubling it as "".

Example of sending a request with the above extension content using the WebSocket interface:

s 16K -a-general extension="{""client_info"":{""billing_key"":""any_key_for_billing_aggregation""}}" authorization={YOUR_APPKEY}