@databuddy/sdk 2.3.26 → 2.3.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,15 +124,10 @@ interface DatabuddyLLMOptions {
124
124
  */
125
125
  apiUrl?: string;
126
126
  /**
127
- * API key for authentication
127
+ * API key for authentication (determines owner - org or user)
128
128
  * @default process.env.DATABUDDY_API_KEY
129
129
  */
130
130
  apiKey?: string;
131
- /**
132
- * Client/Website ID for tracking
133
- * @default process.env.DATABUDDY_CLIENT_ID
134
- */
135
- clientId?: string;
136
131
  /**
137
132
  * Custom transport function to send log entries
138
133
  * If provided, overrides default HTTP transport
@@ -175,10 +170,6 @@ interface TrackOptions {
175
170
  * Trace ID to link related calls together
176
171
  */
177
172
  traceId?: string;
178
- /**
179
- * Client ID for this specific call (overrides instance-level clientId)
180
- */
181
- clientId?: string;
182
173
  /**
183
174
  * Whether to compute costs using TokenLens
184
175
  * @default true
@@ -207,11 +198,11 @@ interface TrackOptions {
207
198
  * import { databuddyLLM, httpTransport } from "@databuddy/sdk/ai/vercel";
208
199
  *
209
200
  * const { track } = databuddyLLM({
210
- * transport: httpTransport("https://api.example.com/ai-logs", "client-id", "api-key"),
201
+ * transport: httpTransport("https://api.example.com/ai-logs", "api-key"),
211
202
  * });
212
203
  * ```
213
204
  */
214
- declare const httpTransport: (url: string, clientId?: string, apiKey?: string) => Transport;
205
+ declare const httpTransport: (url: string, apiKey?: string) => Transport;
215
206
 
216
207
  /**
217
208
  * Vercel AI SDK middleware for Databuddy
@@ -124,15 +124,10 @@ interface DatabuddyLLMOptions {
124
124
  */
125
125
  apiUrl?: string;
126
126
  /**
127
- * API key for authentication
127
+ * API key for authentication (determines owner - org or user)
128
128
  * @default process.env.DATABUDDY_API_KEY
129
129
  */
130
130
  apiKey?: string;
131
- /**
132
- * Client/Website ID for tracking
133
- * @default process.env.DATABUDDY_CLIENT_ID
134
- */
135
- clientId?: string;
136
131
  /**
137
132
  * Custom transport function to send log entries
138
133
  * If provided, overrides default HTTP transport
@@ -175,10 +170,6 @@ interface TrackOptions {
175
170
  * Trace ID to link related calls together
176
171
  */
177
172
  traceId?: string;
178
- /**
179
- * Client ID for this specific call (overrides instance-level clientId)
180
- */
181
- clientId?: string;
182
173
  /**
183
174
  * Whether to compute costs using TokenLens
184
175
  * @default true
@@ -207,11 +198,11 @@ interface TrackOptions {
207
198
  * import { databuddyLLM, httpTransport } from "@databuddy/sdk/ai/vercel";
208
199
  *
209
200
  * const { track } = databuddyLLM({
210
- * transport: httpTransport("https://api.example.com/ai-logs", "client-id", "api-key"),
201
+ * transport: httpTransport("https://api.example.com/ai-logs", "api-key"),
211
202
  * });
212
203
  * ```
213
204
  */
214
- declare const httpTransport: (url: string, clientId?: string, apiKey?: string) => Transport;
205
+ declare const httpTransport: (url: string, apiKey?: string) => Transport;
215
206
 
216
207
  /**
217
208
  * Vercel AI SDK middleware for Databuddy
@@ -349,7 +349,7 @@ const buildStreamOutput = (generatedText, reasoningText, toolCalls, sources = []
349
349
  ];
350
350
  };
351
351
 
352
- const createDefaultTransport = (apiUrl, clientId, apiKey) => {
352
+ const createDefaultTransport = (apiUrl, apiKey) => {
353
353
  return async (call) => {
354
354
  const headers = {
355
355
  "Content-Type": "application/json"
@@ -357,9 +357,6 @@ const createDefaultTransport = (apiUrl, clientId, apiKey) => {
357
357
  if (apiKey) {
358
358
  headers.Authorization = `Bearer ${apiKey}`;
359
359
  }
360
- if (clientId) {
361
- headers["databuddy-client-id"] = clientId;
362
- }
363
360
  const response = await fetch(apiUrl, {
364
361
  method: "POST",
365
362
  headers,
@@ -372,7 +369,7 @@ const createDefaultTransport = (apiUrl, clientId, apiKey) => {
372
369
  }
373
370
  };
374
371
  };
375
- const httpTransport = (url, clientId, apiKey) => {
372
+ const httpTransport = (url, apiKey) => {
376
373
  return async (call) => {
377
374
  const headers = {
378
375
  "Content-Type": "application/json"
@@ -380,9 +377,6 @@ const httpTransport = (url, clientId, apiKey) => {
380
377
  if (apiKey) {
381
378
  headers.Authorization = `Bearer ${apiKey}`;
382
379
  }
383
- if (clientId) {
384
- headers["databuddy-client-id"] = clientId;
385
- }
386
380
  const response = await fetch(url, {
387
381
  method: "POST",
388
382
  headers,
@@ -430,7 +424,6 @@ const databuddyLLM = (options = {}) => {
430
424
  const {
431
425
  apiUrl,
432
426
  apiKey,
433
- clientId,
434
427
  transport: customTransport,
435
428
  computeCosts: defaultComputeCosts = true,
436
429
  privacyMode: defaultPrivacyMode = false,
@@ -440,7 +433,6 @@ const databuddyLLM = (options = {}) => {
440
433
  } = options;
441
434
  const transport = customTransport ? customTransport : createDefaultTransport(
442
435
  apiUrl ?? process.env.DATABUDDY_API_URL ?? "https://basket.databuddy.cc/llm",
443
- clientId ?? process.env.DATABUDDY_CLIENT_ID,
444
436
  apiKey ?? process.env.DATABUDDY_API_KEY
445
437
  );
446
438
  const track = (model, trackOptions = {}) => {
@@ -448,13 +440,6 @@ const databuddyLLM = (options = {}) => {
448
440
  if (trackOptions.transport) {
449
441
  return trackOptions.transport;
450
442
  }
451
- if (trackOptions.clientId && trackOptions.clientId !== clientId) {
452
- return createDefaultTransport(
453
- apiUrl ?? process.env.DATABUDDY_API_URL ?? "https://basket.databuddy.cc/llm",
454
- trackOptions.clientId,
455
- apiKey ?? process.env.DATABUDDY_API_KEY
456
- );
457
- }
458
443
  return transport;
459
444
  };
460
445
  return Object.create(model, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databuddy/sdk",
3
- "version": "2.3.26",
3
+ "version": "2.3.27",
4
4
  "description": "Official Databuddy Analytics SDK",
5
5
  "main": "./dist/core/index.mjs",
6
6
  "types": "./dist/core/index.d.ts",