@@ -194,6 +194,8 @@ export interface ClientOptions {
194194 */
195195 apiKey ?: string | undefined ;
196196
197+ projectID ?: string | null | undefined ;
198+
197199 /**
198200 * Specifies the environment to use for the API.
199201 *
@@ -277,6 +279,7 @@ export interface ClientOptions {
277279 */
278280export class Letta {
279281 apiKey : string ;
282+ projectID : string | null ;
280283
281284 baseURL : string ;
282285 maxRetries : number ;
@@ -294,6 +297,7 @@ export class Letta {
294297 * API Client for interfacing with the Letta API.
295298 *
296299 * @param {string | undefined } [opts.apiKey=process.env['LETTA_API_KEY'] ?? undefined]
300+ * @param {string | null | undefined } [opts.projectID]
297301 * @param {Environment } [opts.environment=cloud] - Specifies the environment URL to use for the API.
298302 * @param {string } [opts.baseURL=process.env['LETTA_BASE_URL'] ?? https://api.letta.com] - Override the default base URL for the API.
299303 * @param {number } [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -306,6 +310,7 @@ export class Letta {
306310 constructor ( {
307311 baseURL = readEnv ( 'LETTA_BASE_URL' ) ,
308312 apiKey = readEnv ( 'LETTA_API_KEY' ) ,
313+ projectID = null ,
309314 ...opts
310315 } : ClientOptions = { } ) {
311316 if ( apiKey === undefined ) {
@@ -316,6 +321,7 @@ export class Letta {
316321
317322 const options : ClientOptions = {
318323 apiKey,
324+ projectID,
319325 ...opts ,
320326 baseURL,
321327 environment : opts . environment ?? 'cloud' ,
@@ -345,6 +351,7 @@ export class Letta {
345351 this . _options = options ;
346352
347353 this . apiKey = apiKey ;
354+ this . projectID = projectID ;
348355 }
349356
350357 /**
@@ -362,6 +369,7 @@ export class Letta {
362369 fetch : this . fetch ,
363370 fetchOptions : this . fetchOptions ,
364371 apiKey : this . apiKey ,
372+ projectID : this . projectID ,
365373 ...options ,
366374 } ) ;
367375 return client ;
@@ -832,6 +840,7 @@ export class Letta {
832840 'X-Stainless-Retry-Count' : String ( retryCount ) ,
833841 ...( options . timeout ? { 'X-Stainless-Timeout' : String ( Math . trunc ( options . timeout / 1000 ) ) } : { } ) ,
834842 ...getPlatformHeaders ( ) ,
843+ 'X-Project' : this . projectID ,
835844 } ,
836845 await this . authHeaders ( options ) ,
837846 this . _options . defaultHeaders ,
0 commit comments