@theokit/sdk 4.9.1 → 4.10.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.cjs CHANGED
@@ -16282,6 +16282,9 @@ function resolveApiKey2(envVars) {
16282
16282
  return void 0;
16283
16283
  }
16284
16284
  function selectTransport(profile, apiKey) {
16285
+ const transformCtx = { apiKey };
16286
+ const transformFetch = profile.transform?.fetch?.(transformCtx);
16287
+ const transformHeaders = profile.transform?.headers?.(transformCtx);
16285
16288
  if (profile.apiMode === "chat_completions") {
16286
16289
  if (profile.name === "ollama") {
16287
16290
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -16298,6 +16301,7 @@ function selectTransport(profile, apiKey) {
16298
16301
  }
16299
16302
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
16300
16303
  if (envOverride !== void 0) opts.baseUrl = envOverride;
16304
+ if (transformFetch !== void 0) opts.fetch = transformFetch;
16301
16305
  return new OpenAIClient(opts);
16302
16306
  }
16303
16307
  if (profile.apiMode === "anthropic_messages") {
@@ -16314,10 +16318,12 @@ function selectTransport(profile, apiKey) {
16314
16318
  return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
16315
16319
  }
16316
16320
  if (profile.apiMode === "responses_api") {
16321
+ const mergedHeaders = profile.extraHeaders !== void 0 || transformHeaders !== void 0 ? { ...profile.extraHeaders, ...transformHeaders } : void 0;
16317
16322
  return new ResponsesApiClient({
16318
16323
  apiKey,
16319
16324
  ...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
16320
- ...profile.extraHeaders !== void 0 ? { extraHeaders: profile.extraHeaders } : {},
16325
+ ...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
16326
+ ...transformFetch !== void 0 ? { fetch: transformFetch } : {},
16321
16327
  providerName: profile.name
16322
16328
  });
16323
16329
  }