@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/eval.cjs CHANGED
@@ -13680,6 +13680,9 @@ function resolveApiKey2(envVars) {
13680
13680
  return void 0;
13681
13681
  }
13682
13682
  function selectTransport(profile, apiKey) {
13683
+ const transformCtx = { apiKey };
13684
+ const transformFetch = profile.transform?.fetch?.(transformCtx);
13685
+ const transformHeaders = profile.transform?.headers?.(transformCtx);
13683
13686
  if (profile.apiMode === "chat_completions") {
13684
13687
  if (profile.name === "ollama") {
13685
13688
  const ollamaBase = process.env.OLLAMA_HOST ?? profile.baseUrl;
@@ -13696,6 +13699,7 @@ function selectTransport(profile, apiKey) {
13696
13699
  }
13697
13700
  const envOverride = resolveBaseUrlEnvOverride(profile.name);
13698
13701
  if (envOverride !== void 0) opts.baseUrl = envOverride;
13702
+ if (transformFetch !== void 0) opts.fetch = transformFetch;
13699
13703
  return new OpenAIClient(opts);
13700
13704
  }
13701
13705
  if (profile.apiMode === "anthropic_messages") {
@@ -13712,10 +13716,12 @@ function selectTransport(profile, apiKey) {
13712
13716
  return new BedrockAnthropicClient(realKey !== void 0 ? { apiKey: realKey } : {});
13713
13717
  }
13714
13718
  if (profile.apiMode === "responses_api") {
13719
+ const mergedHeaders = profile.extraHeaders !== void 0 || transformHeaders !== void 0 ? { ...profile.extraHeaders, ...transformHeaders } : void 0;
13715
13720
  return new ResponsesApiClient({
13716
13721
  apiKey,
13717
13722
  ...profile.baseUrl !== void 0 ? { baseUrl: profile.baseUrl } : {},
13718
- ...profile.extraHeaders !== void 0 ? { extraHeaders: profile.extraHeaders } : {},
13723
+ ...mergedHeaders !== void 0 ? { extraHeaders: mergedHeaders } : {},
13724
+ ...transformFetch !== void 0 ? { fetch: transformFetch } : {},
13719
13725
  providerName: profile.name
13720
13726
  });
13721
13727
  }