Skip to main content
GET
/
api
/
v1
/
llm
/
usage
/
conversations
Typescript (SDK)
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.usage.conversations({
    startTime: 1704067200,
    endTime: 1704153600,
    limit: 30,
    page: "cursor_abc123",
    userIds: [
      "user_123",
      "user_456",
    ],
    groupBy: [
      "user_id",
    ],
  });

  console.log(result);
}

run();
{
  "object": "page",
  "data": [
    {
      "object": "bucket",
      "start_time": 1704067200,
      "end_time": 1704153600,
      "results": [
        {
          "object": "organization.usage.conversations.result",
          "num_conversations_created": 5,
          "num_items_added": 18,
          "num_operations": 30,
          "user_id": "user_123",
          "api_key_id": "key_abc123"
        }
      ]
    }
  ],
  "has_more": false,
  "next_page": null
}

Authorizations

Authorization
string
header
required

Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.

Headers

X-On-Behalf-Of
string

Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.

Query Parameters

start_time
integer
required

Start time (Unix seconds), inclusive

Required range: -9007199254740991 <= x <= 9007199254740991
Example:

1704067200

end_time
integer

End time (Unix seconds), exclusive

Required range: -9007199254740991 <= x <= 9007199254740991
Example:

1704153600

bucket_width
enum<string>
default:1d

Width of each time bucket (1m, 1h, 1d)

Available options:
1m,
1h,
1d
Example:

"1d"

limit
integer

Number of buckets to return

Required range: 1 <= x <= 1440
Example:

30

page
string

Pagination cursor

Example:

"cursor_abc123"

user_ids
string[]

Filter by external Subs (externalUserIds)

Example:
["user_123", "user_456"]
group_by
enum<string>[]

Group by specified fields

Available options:
user_id,
api_key_id

Response

200 - application/json

OK

object
any
required
data
object[]
required
has_more
boolean
required

Whether there are more pages

next_page
string | null
required

Cursor for next page, null if no more pages