Back to API List
This API retrieves LLM and Generative AI usage logs for GenAI features.
| Field | Value |
|---|
| Method | POST |
| Endpoint | https://{{host}}/api/1.1/public/bot/{{botId}}/getLLMUsageLogs |
| Content Type | application/json |
| Authorization | auth: {{JWT}} — See How to generate the JWT Token. |
| API Scope | App Builder: Fetch Gen AI and LLM Usage Logs; Admin Console: API Scopes > Gen AI and LLM Usage Logs |
You can access records spanning up to a 90-day timeframe with one request.
Query Parameters
| Parameter | Required/Optional | Description |
|---|
host | Required | The environment URL. For example, https://platform.kore.ai |
botId | Required | Bot ID or Stream ID. Accessible from the General Settings page of the bot. |
Sample Request
curl --location 'https://{{host}}/1.1/public/bot/st-f3195ec3-72aa-5317-92/getLLMUsageLogs' \
--header 'auth: {{YOUR_JWT_ACCESS_TOKEN}}' \
--header 'Content-Type: application/json' \
--data '{
"dateFrom": "2024-03-07",
"dateTo": "2024-04-26",
"limit": "50",
"skip": "5",
"isDeveloper": true,
"channel": ["msteams", "rtm"],
"featureName": ["Agent Node"],
"taskId": "dg-d4924db4-xxxx-5b4d-ae51-aa5c7be4xxxx",
"channelUserIds": ["29:1gmwl6k7ohtdhxxxx7kvu1yiek_qri4grpmd0k_am9dpzwttw"],
"userIds": ["u-40b3eafc-xxxx-55f2-83e8-cf4d0fbxxxx"],
"sort": {
"field": "Time Taken",
"order": "asc"
}
}'
Body Parameters
| Parameter | Required/Optional | Description |
|---|
dateFrom | Required | The timestamp from which records are displayed. |
dateTo | Required | The timestamp until which records are displayed. |
limit | Required | The number of records to display per page. |
channel | Optional | The channels to include in the metrics. |
channelUIds | Optional | The channel-specific user IDs to include in the metrics. |
isDeveloper | Optional | Whether to include developer metrics. Set to true or false. |
taskId | Optional | Filter records by task IDs. |
userId | Optional | Filter records by user ID. |
sort | Optional | Sort results by Time Taken in the specified order (asc or desc). |
Sample Response
[
{
"Prompt Name": "Default",
"Integration": "OpenAI",
"start Date": "2024-03-08T06:38:54.008Z",
"End Date": "2024-03-08T06:38:58.386Z",
"Time Taken": 4378,
"statusCode": 200,
"Bot ID": "st-73bfdb2f-xxxx-55e6-b4c8-3f568a6exxxx",
"User ID": "u-40b3eafc-xxxx-55f2-83e8-cf4d0fb1xxxx",
"Feature Name ": "GenAI Node",
"Model Name": "GPT-4",
"Channel Name": "msteams",
"Description": "Order pizza-GenAINode0002",
"task Id": "dg-200ad1ff-xxxx-5219-810e-4ee3800dxxxx",
"Status": "Success",
"Payload Details": {
"Prompt Name": "Default",
"Request Payload": {
"model": "gpt-4",
"temperature": 0.5,
"max_tokens": 1500,
"top_p": 1,
"frequency_penalty": 0,
"presence_penalty": 0,
"messages": [
{
"role": "system",
"content": "You are a virtual assistant..."
},
{
"role": "user",
"content": "Order pizza"
}
]
},
"Response Payload": {
"id": "chatcmpl-90OAYDFFkbjgMxhMxKukwqklT6SWO",
"object": "chat.completion",
"created": 1709879934,
"model": "gpt-4-0613",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "{\"bot\":\"I'm sorry, but your message seems incomplete...\"}"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 614,
"completion_tokens": 74,
"total_tokens": 688
}
},
"Request Tokens": 614,
"Response Tokens": 74
}
}
]