@modelrelay/sdk 1.36.0 → 1.42.0

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.
package/dist/index.js CHANGED
@@ -69,7 +69,7 @@ import {
69
69
  toolResultMessage,
70
70
  tryParseToolArgs,
71
71
  zodToJsonSchema
72
- } from "./chunk-ADQ74R7T.js";
72
+ } from "./chunk-PLZWDUOP.js";
73
73
  import {
74
74
  __export
75
75
  } from "./chunk-MLKGABMK.js";
@@ -470,6 +470,59 @@ var AuthClient = class {
470
470
  throw err;
471
471
  }
472
472
  }
473
+ /**
474
+ * Start an OAuth flow for customer authentication.
475
+ *
476
+ * This initiates the OAuth redirect flow where users authenticate with
477
+ * GitHub or Google and are redirected back to your application with a
478
+ * customer token.
479
+ *
480
+ * @param request - OAuth start parameters
481
+ * @param request.projectId - The project ID to authenticate against
482
+ * @param request.provider - OAuth provider: "github" or "google"
483
+ * @param request.redirectUri - Where to redirect after OAuth. Must be in project's whitelist.
484
+ * @returns Promise with the redirect URL
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const { redirectUrl } = await client.auth.oauthStart({
489
+ * projectId: "your-project-id",
490
+ * provider: "github",
491
+ * redirectUri: "https://your-app.com/auth/callback",
492
+ * });
493
+ *
494
+ * // Redirect user to the OAuth provider
495
+ * window.location.href = redirectUrl;
496
+ *
497
+ * // After OAuth, your callback receives a POST with:
498
+ * // token, token_type, expires_at, expires_in, project_id, customer_id, customer_external_id, tier_code
499
+ * ```
500
+ */
501
+ async oauthStart(request) {
502
+ if (!request.projectId?.trim()) {
503
+ throw new ConfigError("projectId is required");
504
+ }
505
+ if (!request.provider?.trim()) {
506
+ throw new ConfigError("provider is required");
507
+ }
508
+ if (!request.redirectUri?.trim()) {
509
+ throw new ConfigError("redirectUri is required");
510
+ }
511
+ const apiResp = await this.http.json(
512
+ "/auth/customer/oauth/start",
513
+ {
514
+ method: "POST",
515
+ body: {
516
+ project_id: request.projectId,
517
+ provider: request.provider,
518
+ redirect_uri: request.redirectUri
519
+ }
520
+ }
521
+ );
522
+ return {
523
+ redirectUrl: apiResp.redirect_url
524
+ };
525
+ }
473
526
  };
474
527
  function normalizeFrontendToken(payload, meta) {
475
528
  return {
@@ -4222,6 +4275,94 @@ var SessionsClient = class {
4222
4275
  }
4223
4276
  };
4224
4277
 
4278
+ // src/tiers.ts
4279
+ function defaultTierModelId(tier) {
4280
+ const def = tier.models.find((m) => m.is_default);
4281
+ if (def) return def.model_id;
4282
+ if (tier.models.length === 1) return tier.models[0].model_id;
4283
+ return void 0;
4284
+ }
4285
+ var TiersClient = class {
4286
+ constructor(http, cfg) {
4287
+ this.http = http;
4288
+ this.apiKey = cfg.apiKey ? parseApiKey(cfg.apiKey) : void 0;
4289
+ this.hasSecretKey = this.apiKey ? isSecretKey(this.apiKey) : false;
4290
+ }
4291
+ ensureApiKey() {
4292
+ if (!this.apiKey) {
4293
+ throw new ConfigError(
4294
+ "API key (mr_pk_* or mr_sk_*) required for tier operations"
4295
+ );
4296
+ }
4297
+ }
4298
+ ensureSecretKey() {
4299
+ if (!this.apiKey || !this.hasSecretKey) {
4300
+ throw new ConfigError(
4301
+ "Secret key (mr_sk_*) required for checkout operations"
4302
+ );
4303
+ }
4304
+ }
4305
+ /**
4306
+ * List all tiers in the project.
4307
+ */
4308
+ async list() {
4309
+ this.ensureApiKey();
4310
+ const response = await this.http.json("/tiers", {
4311
+ method: "GET",
4312
+ apiKey: this.apiKey
4313
+ });
4314
+ return response.tiers;
4315
+ }
4316
+ /**
4317
+ * Get a tier by ID.
4318
+ */
4319
+ async get(tierId) {
4320
+ this.ensureApiKey();
4321
+ if (!tierId?.trim()) {
4322
+ throw new ConfigError("tierId is required");
4323
+ }
4324
+ const response = await this.http.json(`/tiers/${tierId}`, {
4325
+ method: "GET",
4326
+ apiKey: this.apiKey
4327
+ });
4328
+ return response.tier;
4329
+ }
4330
+ /**
4331
+ * Create a Stripe checkout session for a tier (Stripe-first flow).
4332
+ *
4333
+ * This enables users to subscribe before authenticating. Stripe collects
4334
+ * the customer's email during checkout. After checkout completes, a
4335
+ * customer record is created with the email from Stripe. The customer
4336
+ * can later be linked to an identity via POST /customers/claim.
4337
+ *
4338
+ * Requires a secret key (mr_sk_*).
4339
+ *
4340
+ * @param tierId - The tier ID to create a checkout session for
4341
+ * @param request - Checkout session request with redirect URLs
4342
+ * @returns Checkout session with Stripe URL
4343
+ */
4344
+ async checkout(tierId, request) {
4345
+ this.ensureSecretKey();
4346
+ if (!tierId?.trim()) {
4347
+ throw new ConfigError("tierId is required");
4348
+ }
4349
+ if (!request.success_url?.trim()) {
4350
+ throw new ConfigError("success_url is required");
4351
+ }
4352
+ if (!request.cancel_url?.trim()) {
4353
+ throw new ConfigError("cancel_url is required");
4354
+ }
4355
+ return await this.http.json(
4356
+ `/tiers/${tierId}/checkout`,
4357
+ {
4358
+ method: "POST",
4359
+ apiKey: this.apiKey,
4360
+ body: request
4361
+ }
4362
+ );
4363
+ }
4364
+ };
4365
+
4225
4366
  // src/http.ts
4226
4367
  var HTTPClient = class {
4227
4368
  constructor(cfg) {
@@ -7798,6 +7939,7 @@ var ModelRelay = class _ModelRelay {
7798
7939
  });
7799
7940
  this.images = new ImagesClient(this.http, auth);
7800
7941
  this.sessions = new SessionsClient(this, this.http, auth);
7942
+ this.tiers = new TiersClient(this.http, { apiKey });
7801
7943
  }
7802
7944
  forCustomer(customerId) {
7803
7945
  return new CustomerScopedModelRelay(this.responses, customerId, this.baseUrl);
@@ -7873,6 +8015,7 @@ export {
7873
8015
  StructuredExhaustedError,
7874
8016
  StructuredJSONStream,
7875
8017
  SubscriptionStatuses,
8018
+ TiersClient,
7876
8019
  ToolArgsError,
7877
8020
  ToolArgumentError,
7878
8021
  ToolCallAccumulator,
@@ -7915,6 +8058,7 @@ export {
7915
8058
  createUserMessage,
7916
8059
  createWebTool,
7917
8060
  defaultRetryHandler,
8061
+ defaultTierModelId,
7918
8062
  executeWithRetry,
7919
8063
  firstToolCall,
7920
8064
  formatToolErrorForModel,
package/dist/node.cjs CHANGED
@@ -52,7 +52,7 @@ var import_child_process = require("child_process");
52
52
  // package.json
53
53
  var package_default = {
54
54
  name: "@modelrelay/sdk",
55
- version: "1.36.0",
55
+ version: "1.42.0",
56
56
  description: "TypeScript SDK for the ModelRelay API",
57
57
  type: "module",
58
58
  main: "dist/index.cjs",
package/dist/node.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { k as Tool, r as ToolRegistry } from './tools-Cnl2MgVa.cjs';
1
+ import { m as Tool, t as ToolRegistry } from './tools-CWEBFsql.cjs';
2
2
 
3
3
  /**
4
4
  * Local filesystem tool pack for client-side tool execution.
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { k as Tool, r as ToolRegistry } from './tools-Cnl2MgVa.js';
1
+ import { m as Tool, t as ToolRegistry } from './tools-CWEBFsql.js';
2
2
 
3
3
  /**
4
4
  * Local filesystem tool pack for client-side tool execution.
package/dist/node.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  ToolArgumentError,
4
4
  ToolRegistry,
5
5
  ToolTypes
6
- } from "./chunk-ADQ74R7T.js";
6
+ } from "./chunk-PLZWDUOP.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
 
9
9
  // src/tools_local_fs.ts
@@ -268,14 +268,14 @@ interface FrontendToken {
268
268
  sessionId: string;
269
269
  /** The project ID this token is scoped to. */
270
270
  projectId: string;
271
- /** The internal customer ID (UUID). */
272
- customerId: string;
271
+ /** The internal customer ID (UUID). Only present for managed billing projects; BYOB projects have end-users but not customers. */
272
+ customerId?: string;
273
273
  /** The external customer ID provided by the application. */
274
274
  customerExternalId: string;
275
275
  /** The tier code for the customer (e.g., "free", "pro", "enterprise").
276
276
  * Optional for BYOB (external billing) projects where customers may not have subscriptions.
277
277
  */
278
- tierCode?: string;
278
+ tierCode?: TierCode;
279
279
  /**
280
280
  * Publishable key used for issuance. Added client-side for caching.
281
281
  */
@@ -304,10 +304,11 @@ interface CustomerToken {
304
304
  expiresIn: number;
305
305
  tokenType: TokenType;
306
306
  projectId: string;
307
- customerId: string;
307
+ /** Only present for managed billing projects; BYOB projects have end-users but not customers. */
308
+ customerId?: string;
308
309
  customerExternalId: string;
309
310
  /** Optional for BYOB (external billing) projects */
310
- tierCode?: string;
311
+ tierCode?: TierCode;
311
312
  }
312
313
  interface OIDCExchangeRequest {
313
314
  idToken: string;
@@ -355,12 +356,12 @@ interface DeviceTokenResponse {
355
356
  tokenType: TokenType;
356
357
  /** The project ID this token is scoped to */
357
358
  projectId: string;
358
- /** The internal customer ID (UUID) */
359
- customerId: string;
359
+ /** The internal customer ID (UUID). Only present for managed billing projects; BYOB projects have end-users but not customers. */
360
+ customerId?: string;
360
361
  /** The external customer ID */
361
362
  customerExternalId: string;
362
363
  /** The tier code for the customer (optional for BYOB projects) */
363
- tierCode?: string;
364
+ tierCode?: TierCode;
364
365
  }
365
366
  /**
366
367
  * Pending response from polling device token endpoint.
@@ -704,9 +705,10 @@ interface APIFrontendToken {
704
705
  key_id: string;
705
706
  session_id: string;
706
707
  project_id: string;
707
- customer_id: string;
708
+ /** Optional for BYOB projects where customers are not created in the billing sense. */
709
+ customer_id?: string;
708
710
  customer_external_id: string;
709
- tier_code?: string;
711
+ tier_code?: TierCode;
710
712
  }
711
713
  interface APICustomerRef {
712
714
  id: string;
@@ -1169,4 +1171,4 @@ interface RetryOptions {
1169
1171
  */
1170
1172
  declare function executeWithRetry(registry: ToolRegistry, toolCalls: ToolCall[], options?: RetryOptions): Promise<ToolExecutionResult[]>;
1171
1173
 
1172
- export { assistantMessageWithToolCalls as $, type ApiKey as A, type BillingProvider as B, type CustomerTokenRequest as C, type DeviceStartRequest as D, DEFAULT_BASE_URL as E, type FrontendCustomer as F, createFunctionTool as G, createFunctionToolFromSchema as H, type InputItem as I, createWebTool as J, toolChoiceAuto as K, toolChoiceRequired as L, type MetricsCallbacks as M, toolChoiceNone as N, type OIDCExchangeRequest as O, type ProviderId as P, hasToolCalls as Q, type RetryConfig as R, type StructuredJSONEvent as S, type TraceCallbacks as T, firstToolCall as U, createUserMessage as V, createAssistantMessage as W, createSystemMessage as X, toolResultMessage as Y, type ZodLikeSchema as Z, respondToToolCall as _, type RequestContext as a, type OutputFormatType as a$, createToolCall as a0, createFunctionCall as a1, ToolCallAccumulator as a2, zodToJsonSchema as a3, parseToolArgs as a4, tryParseToolArgs as a5, parseToolArgsRaw as a6, ToolArgsError as a7, formatToolErrorForModel as a8, hasRetryableErrors as a9, type Usage as aA, createUsage as aB, type UsageSummary as aC, type Project as aD, MessageRoles as aE, type MessageRole as aF, ContentPartTypes as aG, type ContentPartType as aH, type ContentPart as aI, InputItemTypes as aJ, type InputItemType as aK, OutputItemTypes as aL, type OutputItemType as aM, type OutputItem as aN, ToolTypes as aO, type ToolType as aP, WebToolIntents as aQ, type WebToolIntent as aR, type FunctionTool as aS, type WebSearchConfig as aT, type XSearchConfig as aU, type CodeExecConfig as aV, ToolChoiceTypes as aW, type ToolChoiceType as aX, type FunctionCall as aY, type ToolCall as aZ, OutputFormatTypes as a_, getRetryableErrors as aa, createRetryMessages as ab, executeWithRetry as ac, type JsonSchemaOptions as ad, type Schema as ae, type ToolHandler as af, type RetryOptions as ag, SDK_VERSION as ah, DEFAULT_CLIENT_HEADER as ai, DEFAULT_CONNECT_TIMEOUT_MS as aj, DEFAULT_REQUEST_TIMEOUT_MS as ak, type NonEmptyArray as al, StopReasons as am, type KnownStopReason as an, type StopReason as ao, asProviderId as ap, asModelId as aq, asTierCode as ar, SubscriptionStatuses as as, BillingProviders as at, type ModelRelayBaseOptions as au, type ModelRelayTokenOptions as av, type ModelRelayTokenProviderOptions as aw, type TokenType as ax, type DeviceTokenResponse as ay, type DeviceTokenPending as az, type TokenProvider as b, type JSONSchemaFormat as b0, type Citation as b1, type HttpRequestMetrics as b2, type StreamFirstTokenMetrics as b3, type TokenUsageMetrics as b4, mergeMetrics as b5, mergeTrace as b6, normalizeStopReason as b7, stopReasonToString as b8, normalizeModelId as b9, modelToString as ba, type ResponseEventType as bb, type MessageStartData as bc, type MessageDeltaData as bd, type MessageStopData as be, type ToolCallDelta as bf, type FunctionCallDelta as bg, type StructuredJSONRecordType as bh, type DeepPartial as bi, type APIFrontendToken as bj, type APICustomerRef as bk, type APICheckoutSession as bl, type APIUsage as bm, type APIResponsesResponse as bn, type APIKey as bo, type FrontendTokenRequest as c, type FrontendToken as d, type FrontendTokenAutoProvisionRequest as e, type CustomerToken as f, type DeviceStartResponse as g, type DeviceTokenResult as h, type ModelId as i, type OutputFormat as j, type Tool as k, type ToolChoice as l, type ResponseEvent as m, type Response as n, type FieldError as o, type RetryMetadata as p, type TransportErrorKind as q, type CustomerMetadata as r, type TierCode as s, type SubscriptionStatusKind as t, ToolRegistry as u, type ToolExecutionResult as v, type PublishableKey as w, type SecretKey as x, type ModelRelayKeyOptions as y, type ModelRelayOptions as z };
1174
+ export { ToolCallAccumulator as $, type ApiKey as A, createFunctionToolFromSchema as B, type CustomerTokenRequest as C, type DeviceStartRequest as D, createWebTool as E, type FrontendCustomer as F, toolChoiceAuto as G, toolChoiceRequired as H, type InputItem as I, toolChoiceNone as J, hasToolCalls as K, firstToolCall as L, type MetricsCallbacks as M, createUserMessage as N, type OIDCExchangeRequest as O, type ProviderId as P, createAssistantMessage as Q, type RetryConfig as R, type StructuredJSONEvent as S, type TraceCallbacks as T, createSystemMessage as U, toolResultMessage as V, respondToToolCall as W, assistantMessageWithToolCalls as X, createToolCall as Y, type ZodLikeSchema as Z, createFunctionCall as _, type RequestContext as a, type OutputFormatType as a$, zodToJsonSchema as a0, parseToolArgs as a1, tryParseToolArgs as a2, parseToolArgsRaw as a3, ToolArgsError as a4, formatToolErrorForModel as a5, hasRetryableErrors as a6, getRetryableErrors as a7, createRetryMessages as a8, executeWithRetry as a9, type Usage as aA, createUsage as aB, type UsageSummary as aC, type Project as aD, MessageRoles as aE, type MessageRole as aF, ContentPartTypes as aG, type ContentPartType as aH, type ContentPart as aI, InputItemTypes as aJ, type InputItemType as aK, OutputItemTypes as aL, type OutputItemType as aM, type OutputItem as aN, ToolTypes as aO, type ToolType as aP, WebToolIntents as aQ, type WebToolIntent as aR, type FunctionTool as aS, type WebSearchConfig as aT, type XSearchConfig as aU, type CodeExecConfig as aV, ToolChoiceTypes as aW, type ToolChoiceType as aX, type FunctionCall as aY, type ToolCall as aZ, OutputFormatTypes as a_, type JsonSchemaOptions as aa, type Schema as ab, type ToolHandler as ac, type RetryOptions as ad, SDK_VERSION as ae, DEFAULT_CLIENT_HEADER as af, DEFAULT_CONNECT_TIMEOUT_MS as ag, DEFAULT_REQUEST_TIMEOUT_MS as ah, type NonEmptyArray as ai, StopReasons as aj, type KnownStopReason as ak, type StopReason as al, asProviderId as am, asModelId as an, asTierCode as ao, SubscriptionStatuses as ap, type SubscriptionStatusKind as aq, BillingProviders as ar, type BillingProvider as as, type CustomerMetadata as at, type ModelRelayBaseOptions as au, type ModelRelayTokenOptions as av, type ModelRelayTokenProviderOptions as aw, type TokenType as ax, type DeviceTokenResponse as ay, type DeviceTokenPending as az, type TokenProvider as b, type JSONSchemaFormat as b0, type Citation as b1, type HttpRequestMetrics as b2, type StreamFirstTokenMetrics as b3, type TokenUsageMetrics as b4, mergeMetrics as b5, mergeTrace as b6, normalizeStopReason as b7, stopReasonToString as b8, normalizeModelId as b9, modelToString as ba, type ResponseEventType as bb, type MessageStartData as bc, type MessageDeltaData as bd, type MessageStopData as be, type ToolCallDelta as bf, type FunctionCallDelta as bg, type StructuredJSONRecordType as bh, type DeepPartial as bi, type APIFrontendToken as bj, type APICustomerRef as bk, type APICheckoutSession as bl, type APIUsage as bm, type APIResponsesResponse as bn, type APIKey as bo, type FrontendTokenRequest as c, type FrontendToken as d, type FrontendTokenAutoProvisionRequest as e, type CustomerToken as f, type DeviceStartResponse as g, type DeviceTokenResult as h, type ModelId as i, type OutputFormat as j, type Tool as k, type ToolChoice as l, type ResponseEvent as m, type Response as n, type FieldError as o, type RetryMetadata as p, type TransportErrorKind as q, ToolRegistry as r, type ToolExecutionResult as s, type TierCode as t, type PublishableKey as u, type SecretKey as v, type ModelRelayKeyOptions as w, type ModelRelayOptions as x, DEFAULT_BASE_URL as y, createFunctionTool as z };
@@ -268,14 +268,14 @@ interface FrontendToken {
268
268
  sessionId: string;
269
269
  /** The project ID this token is scoped to. */
270
270
  projectId: string;
271
- /** The internal customer ID (UUID). */
272
- customerId: string;
271
+ /** The internal customer ID (UUID). Only present for managed billing projects; BYOB projects have end-users but not customers. */
272
+ customerId?: string;
273
273
  /** The external customer ID provided by the application. */
274
274
  customerExternalId: string;
275
275
  /** The tier code for the customer (e.g., "free", "pro", "enterprise").
276
276
  * Optional for BYOB (external billing) projects where customers may not have subscriptions.
277
277
  */
278
- tierCode?: string;
278
+ tierCode?: TierCode;
279
279
  /**
280
280
  * Publishable key used for issuance. Added client-side for caching.
281
281
  */
@@ -304,10 +304,11 @@ interface CustomerToken {
304
304
  expiresIn: number;
305
305
  tokenType: TokenType;
306
306
  projectId: string;
307
- customerId: string;
307
+ /** Only present for managed billing projects; BYOB projects have end-users but not customers. */
308
+ customerId?: string;
308
309
  customerExternalId: string;
309
310
  /** Optional for BYOB (external billing) projects */
310
- tierCode?: string;
311
+ tierCode?: TierCode;
311
312
  }
312
313
  interface OIDCExchangeRequest {
313
314
  idToken: string;
@@ -355,12 +356,12 @@ interface DeviceTokenResponse {
355
356
  tokenType: TokenType;
356
357
  /** The project ID this token is scoped to */
357
358
  projectId: string;
358
- /** The internal customer ID (UUID) */
359
- customerId: string;
359
+ /** The internal customer ID (UUID). Only present for managed billing projects; BYOB projects have end-users but not customers. */
360
+ customerId?: string;
360
361
  /** The external customer ID */
361
362
  customerExternalId: string;
362
363
  /** The tier code for the customer (optional for BYOB projects) */
363
- tierCode?: string;
364
+ tierCode?: TierCode;
364
365
  }
365
366
  /**
366
367
  * Pending response from polling device token endpoint.
@@ -704,9 +705,10 @@ interface APIFrontendToken {
704
705
  key_id: string;
705
706
  session_id: string;
706
707
  project_id: string;
707
- customer_id: string;
708
+ /** Optional for BYOB projects where customers are not created in the billing sense. */
709
+ customer_id?: string;
708
710
  customer_external_id: string;
709
- tier_code?: string;
711
+ tier_code?: TierCode;
710
712
  }
711
713
  interface APICustomerRef {
712
714
  id: string;
@@ -1169,4 +1171,4 @@ interface RetryOptions {
1169
1171
  */
1170
1172
  declare function executeWithRetry(registry: ToolRegistry, toolCalls: ToolCall[], options?: RetryOptions): Promise<ToolExecutionResult[]>;
1171
1173
 
1172
- export { assistantMessageWithToolCalls as $, type ApiKey as A, type BillingProvider as B, type CustomerTokenRequest as C, type DeviceStartRequest as D, DEFAULT_BASE_URL as E, type FrontendCustomer as F, createFunctionTool as G, createFunctionToolFromSchema as H, type InputItem as I, createWebTool as J, toolChoiceAuto as K, toolChoiceRequired as L, type MetricsCallbacks as M, toolChoiceNone as N, type OIDCExchangeRequest as O, type ProviderId as P, hasToolCalls as Q, type RetryConfig as R, type StructuredJSONEvent as S, type TraceCallbacks as T, firstToolCall as U, createUserMessage as V, createAssistantMessage as W, createSystemMessage as X, toolResultMessage as Y, type ZodLikeSchema as Z, respondToToolCall as _, type RequestContext as a, type OutputFormatType as a$, createToolCall as a0, createFunctionCall as a1, ToolCallAccumulator as a2, zodToJsonSchema as a3, parseToolArgs as a4, tryParseToolArgs as a5, parseToolArgsRaw as a6, ToolArgsError as a7, formatToolErrorForModel as a8, hasRetryableErrors as a9, type Usage as aA, createUsage as aB, type UsageSummary as aC, type Project as aD, MessageRoles as aE, type MessageRole as aF, ContentPartTypes as aG, type ContentPartType as aH, type ContentPart as aI, InputItemTypes as aJ, type InputItemType as aK, OutputItemTypes as aL, type OutputItemType as aM, type OutputItem as aN, ToolTypes as aO, type ToolType as aP, WebToolIntents as aQ, type WebToolIntent as aR, type FunctionTool as aS, type WebSearchConfig as aT, type XSearchConfig as aU, type CodeExecConfig as aV, ToolChoiceTypes as aW, type ToolChoiceType as aX, type FunctionCall as aY, type ToolCall as aZ, OutputFormatTypes as a_, getRetryableErrors as aa, createRetryMessages as ab, executeWithRetry as ac, type JsonSchemaOptions as ad, type Schema as ae, type ToolHandler as af, type RetryOptions as ag, SDK_VERSION as ah, DEFAULT_CLIENT_HEADER as ai, DEFAULT_CONNECT_TIMEOUT_MS as aj, DEFAULT_REQUEST_TIMEOUT_MS as ak, type NonEmptyArray as al, StopReasons as am, type KnownStopReason as an, type StopReason as ao, asProviderId as ap, asModelId as aq, asTierCode as ar, SubscriptionStatuses as as, BillingProviders as at, type ModelRelayBaseOptions as au, type ModelRelayTokenOptions as av, type ModelRelayTokenProviderOptions as aw, type TokenType as ax, type DeviceTokenResponse as ay, type DeviceTokenPending as az, type TokenProvider as b, type JSONSchemaFormat as b0, type Citation as b1, type HttpRequestMetrics as b2, type StreamFirstTokenMetrics as b3, type TokenUsageMetrics as b4, mergeMetrics as b5, mergeTrace as b6, normalizeStopReason as b7, stopReasonToString as b8, normalizeModelId as b9, modelToString as ba, type ResponseEventType as bb, type MessageStartData as bc, type MessageDeltaData as bd, type MessageStopData as be, type ToolCallDelta as bf, type FunctionCallDelta as bg, type StructuredJSONRecordType as bh, type DeepPartial as bi, type APIFrontendToken as bj, type APICustomerRef as bk, type APICheckoutSession as bl, type APIUsage as bm, type APIResponsesResponse as bn, type APIKey as bo, type FrontendTokenRequest as c, type FrontendToken as d, type FrontendTokenAutoProvisionRequest as e, type CustomerToken as f, type DeviceStartResponse as g, type DeviceTokenResult as h, type ModelId as i, type OutputFormat as j, type Tool as k, type ToolChoice as l, type ResponseEvent as m, type Response as n, type FieldError as o, type RetryMetadata as p, type TransportErrorKind as q, type CustomerMetadata as r, type TierCode as s, type SubscriptionStatusKind as t, ToolRegistry as u, type ToolExecutionResult as v, type PublishableKey as w, type SecretKey as x, type ModelRelayKeyOptions as y, type ModelRelayOptions as z };
1174
+ export { ToolCallAccumulator as $, type ApiKey as A, createFunctionToolFromSchema as B, type CustomerTokenRequest as C, type DeviceStartRequest as D, createWebTool as E, type FrontendCustomer as F, toolChoiceAuto as G, toolChoiceRequired as H, type InputItem as I, toolChoiceNone as J, hasToolCalls as K, firstToolCall as L, type MetricsCallbacks as M, createUserMessage as N, type OIDCExchangeRequest as O, type ProviderId as P, createAssistantMessage as Q, type RetryConfig as R, type StructuredJSONEvent as S, type TraceCallbacks as T, createSystemMessage as U, toolResultMessage as V, respondToToolCall as W, assistantMessageWithToolCalls as X, createToolCall as Y, type ZodLikeSchema as Z, createFunctionCall as _, type RequestContext as a, type OutputFormatType as a$, zodToJsonSchema as a0, parseToolArgs as a1, tryParseToolArgs as a2, parseToolArgsRaw as a3, ToolArgsError as a4, formatToolErrorForModel as a5, hasRetryableErrors as a6, getRetryableErrors as a7, createRetryMessages as a8, executeWithRetry as a9, type Usage as aA, createUsage as aB, type UsageSummary as aC, type Project as aD, MessageRoles as aE, type MessageRole as aF, ContentPartTypes as aG, type ContentPartType as aH, type ContentPart as aI, InputItemTypes as aJ, type InputItemType as aK, OutputItemTypes as aL, type OutputItemType as aM, type OutputItem as aN, ToolTypes as aO, type ToolType as aP, WebToolIntents as aQ, type WebToolIntent as aR, type FunctionTool as aS, type WebSearchConfig as aT, type XSearchConfig as aU, type CodeExecConfig as aV, ToolChoiceTypes as aW, type ToolChoiceType as aX, type FunctionCall as aY, type ToolCall as aZ, OutputFormatTypes as a_, type JsonSchemaOptions as aa, type Schema as ab, type ToolHandler as ac, type RetryOptions as ad, SDK_VERSION as ae, DEFAULT_CLIENT_HEADER as af, DEFAULT_CONNECT_TIMEOUT_MS as ag, DEFAULT_REQUEST_TIMEOUT_MS as ah, type NonEmptyArray as ai, StopReasons as aj, type KnownStopReason as ak, type StopReason as al, asProviderId as am, asModelId as an, asTierCode as ao, SubscriptionStatuses as ap, type SubscriptionStatusKind as aq, BillingProviders as ar, type BillingProvider as as, type CustomerMetadata as at, type ModelRelayBaseOptions as au, type ModelRelayTokenOptions as av, type ModelRelayTokenProviderOptions as aw, type TokenType as ax, type DeviceTokenResponse as ay, type DeviceTokenPending as az, type TokenProvider as b, type JSONSchemaFormat as b0, type Citation as b1, type HttpRequestMetrics as b2, type StreamFirstTokenMetrics as b3, type TokenUsageMetrics as b4, mergeMetrics as b5, mergeTrace as b6, normalizeStopReason as b7, stopReasonToString as b8, normalizeModelId as b9, modelToString as ba, type ResponseEventType as bb, type MessageStartData as bc, type MessageDeltaData as bd, type MessageStopData as be, type ToolCallDelta as bf, type FunctionCallDelta as bg, type StructuredJSONRecordType as bh, type DeepPartial as bi, type APIFrontendToken as bj, type APICustomerRef as bk, type APICheckoutSession as bl, type APIUsage as bm, type APIResponsesResponse as bn, type APIKey as bo, type FrontendTokenRequest as c, type FrontendToken as d, type FrontendTokenAutoProvisionRequest as e, type CustomerToken as f, type DeviceStartResponse as g, type DeviceTokenResult as h, type ModelId as i, type OutputFormat as j, type Tool as k, type ToolChoice as l, type ResponseEvent as m, type Response as n, type FieldError as o, type RetryMetadata as p, type TransportErrorKind as q, ToolRegistry as r, type ToolExecutionResult as s, type TierCode as t, type PublishableKey as u, type SecretKey as v, type ModelRelayKeyOptions as w, type ModelRelayOptions as x, DEFAULT_BASE_URL as y, createFunctionTool as z };