全部產品
Search
文件中心

Intelligent Media Services:API說明

更新時間:Oct 25, 2025

本文為您介紹AUI Kits智能體即時互動情境的API說明。

擷取RTC的token

產生rtc通話的token,供通話情境下使用。

使用說明

  • 請求協議:http/https

  • 請求Path:/api/v2/aiagent/getRtcAuthToken

  • 是否需要授權:是

  • 請求Method:POST

  • 請求ContentType:JSON

  • 依賴配置:biz.live_mic.app_id、biz.live_mic.app_key

請求參數

名稱

類型

是否必填

樣本值

描述

user_id

String

userid****

使用者id

channel_id

String

channelid****

頻道id。

說明

如果端側不傳,則由伺服器端產生。伺服器端建置規則:32位uuid字串(去掉-)

返回資料

名稱

類型

樣本值

描述

code

Integer

200

業務響應碼。參考HTTP響應碼

rtc_auth_token

String

eyJnc2xiIjp****

RTC的token

channel_id

String

channelid****

使用的頻道id

timestamp

Long

1700000000

有效期間。單位:秒。預設24小時有效

樣本

請求樣本

{
    "user_id": "usertid****",
    "channel_id":"channelid****"
}

正常返回樣本

{
    "code": 200,
    "rtc_auth_token": "eyJnc2xiIjp****",
    "channel_id": "channelid****",
    "timestamp": 1700000000
}

產生直播互動訊息所需的token

產生直播互動訊息所需的token,供訊息對話情境下使用。

使用說明

  • 請求協議:http/https

  • 請求Path:/api/v2/aiagent/generateMessageChatToken

  • 是否需要授權:是

  • 請求Method:POST

  • 請求ContentType:JSON

  • 依賴配置: biz.openapi.access.key、biz.openapi.access.secret

請求參數

名稱

類型

是否必填

樣本值

描述

ai_agent_id

String

19de81b3b3d94abda22****

智能體Id

user_id

String

userid****

要登入的使用者的ID。

僅限A-Z,a-z,0-9及"_",最長64位元組

role

String

admin

角色,為admin時,表示該使用者可以調用“管控類”介面。預設空。

expire

Integer

3600

逾時時間,單位秒,預設3600秒。

region

String

cn-shanghai

智能體所在的地區。詳細RegionId,請參見服務存取點

返回資料

名稱

類型

樣本值

描述

code

Integer

200

業務響應碼。參考HTTP響應碼

message

String

success

描述資訊

request_id

String

7B117AF5-2A16-412C-B127-****

請求阿里雲openAPI的請求標識

app_id

String

****

使用者的AppID

token

String

acet****

產生的Token

user_id

String

userid****

使用者入會的UserId

nonce

String

AK-****

產生Token所用的Nonce

role

String

admin

產生Token所用的角色

timestamp

Long

1700000000

到期時間,到期時間 = 目前時間+到期時間長度,單位秒

app_sign

String

H4sIAAAAAAAE****

應用AppSign

樣本

請求樣本

{
    "user_id": "userid****",
    "ai_agent_id":"19de81b3b3d94abda22******",
    "role":"admin",
    "expire":1800,
    "region":"cn-shanghai"
}

正常返回樣本

{
    "code": 200,
    "message": "success",
    "role": "admin",
    "user_id": "userid****",
    "app_id": "****",
    "nonce": "AK-****",
    "request_id": "7B117AF5-2A16-412C-B127-****",
    "token": "acet****",
    "timestamp": 1700000000,
    "app_sign": "H4sIAAAAAAAE****",
}

查詢智能體執行個體詳情

查詢智能體執行個體,供通話情境使用

使用說明

  • 請求協議:http/https

  • 請求Path:/api/v2/aiagent/describeAIAgentInstance

  • 是否需要授權:是

  • 請求Method:POST

  • 請求ContentType:JSON

  • 依賴配置: biz.openapi.access.key、biz.openapi.access.secret

請求參數

名稱

類型

是否必填

樣本值

描述

user_id

String

userid****

使用者id

ai_agent_instance_id

String

39f8e0bc005e4f309379701645f4****

智能體執行個體ID

region

String

cn-shanghai

智能體所在的地區。詳細RegionId,請參見服務存取點

返回資料

名稱

類型

樣本值

描述

code

Integer

200

業務響應碼。參考HTTP響應碼

message

String

success

描述資訊

request_id

String

7B117AF5-2A16-412C-B127-****

請求ID

call_log_url

String

https://example.com/call_logs/12345

通話日誌的 URL。

runtime_config

String

{"VoiceChat":{"AgentUserId":"voice_agent_001","ChannelId":"voice_channel_001","AuthToken":"your_voice_chat_auth_token"}}

智能體運行時的配置資訊。詳細內容,請參見

AIAgentRuntimeConfig

status

String

Finished

智能體執行個體的狀態,如 Finished,Executing。

枚舉值:

  • Finished:結束。

  • Executing:運行中。

template_config

String

{"VoiceChat": {"AppId": "your_voice_chat_app_id"}}

智能體模板配置。詳細內容,請參見AIAgentTemplateConfig

user_data

String

{"Email":"johndoe@example.com","Preferences":{"Language":"en"}}

使用者自訂資訊。

agent_config

String

{"xxx":"xx"}

智能體模板配置,填寫的配置會和控制台上的智能體模板配置進行合并更新。不填寫則使用控制台上智能體的預設配置。詳細內容,請參見AIAgentConfig

樣本

請求樣本

{
    "user_id":"userid****",
    "ai_agent_instance_id": "39f8e0bc005e4f309379701645f4****",
    "region":"cn-shanghai"
}

正常返回樣本

{
    "code": 200,
    "message": "success",
    "request_id": "7B117AF5-2A16-412C-B127-****",
    "agent_config": "{\"VoiceChat\": {\"AppId\": \"your_voice_chat_app_id\"}}",
    "template_config": "{\"VoiceChat\": {\"AppId\": \"your_voice_chat_app_id\"}}",
    "call_log_url": "https://example.com/call_logs/12345",
    "user_data": "{\"user_id\": \"test\"}",
    "runtime_config": "{\"VoiceChat\":{\"AgentUserId\":\"voice_agent_001\",\"ChannelId\":\"voice_channel_001\",\"AuthToken\":\"your_voice_chat_auth_token\"}}",
    "status": "Finished"
}