@openrouter/ai-sdk-provider 2.4.3 → 2.5.1

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.
@@ -2673,7 +2673,7 @@ function convertToOpenRouterChatMessages(prompt) {
2673
2673
  }
2674
2674
  const contentParts = content.map(
2675
2675
  (part, index) => {
2676
- var _a17, _b17, _c2, _d2, _e2, _f2;
2676
+ var _a17, _b17, _c2, _d2, _e2, _f2, _g2;
2677
2677
  const isLastTextPart = part.type === "text" && index === lastTextPartIndex;
2678
2678
  const partCacheControl = getCacheControl(part.providerOptions);
2679
2679
  const cacheControl = part.type === "text" ? partCacheControl != null ? partCacheControl : isLastTextPart ? messageCacheControl : void 0 : partCacheControl;
@@ -2696,14 +2696,26 @@ function convertToOpenRouterChatMessages(prompt) {
2696
2696
  }
2697
2697
  }, cacheControl && { cache_control: cacheControl });
2698
2698
  }
2699
- if ((_b17 = part.mediaType) == null ? void 0 : _b17.startsWith("audio/")) {
2699
+ if ((_b17 = part.mediaType) == null ? void 0 : _b17.startsWith("video/")) {
2700
+ const url = getFileUrl({
2701
+ part,
2702
+ defaultMediaType: "video/mp4"
2703
+ });
2704
+ return __spreadValues({
2705
+ type: "video_url",
2706
+ video_url: {
2707
+ url
2708
+ }
2709
+ }, cacheControl && { cache_control: cacheControl });
2710
+ }
2711
+ if ((_c2 = part.mediaType) == null ? void 0 : _c2.startsWith("audio/")) {
2700
2712
  return __spreadValues({
2701
2713
  type: "input_audio",
2702
2714
  input_audio: getInputAudioData(part)
2703
2715
  }, cacheControl && { cache_control: cacheControl });
2704
2716
  }
2705
2717
  const fileName = String(
2706
- (_f2 = (_e2 = (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2.openrouter) == null ? void 0 : _d2.filename) != null ? _e2 : part.filename) != null ? _f2 : ""
2718
+ (_g2 = (_f2 = (_e2 = (_d2 = part.providerOptions) == null ? void 0 : _d2.openrouter) == null ? void 0 : _e2.filename) != null ? _f2 : part.filename) != null ? _g2 : ""
2707
2719
  );
2708
2720
  const fileData = getFileUrl({
2709
2721
  part,
@@ -2788,7 +2800,7 @@ function convertToOpenRouterChatMessages(prompt) {
2788
2800
  return true;
2789
2801
  }
2790
2802
  const format = (_a17 = detail.format) != null ? _a17 : DEFAULT_REASONING_FORMAT;
2791
- if (format !== "anthropic-claude-v1" /* AnthropicClaudeV1 */) {
2803
+ if (format !== "anthropic-claude-v1" /* AnthropicClaudeV1 */ && format !== "google-gemini-v1" /* GoogleGeminiV1 */) {
2792
2804
  return true;
2793
2805
  }
2794
2806
  return !!detail.signature;
@@ -2797,7 +2809,7 @@ function convertToOpenRouterChatMessages(prompt) {
2797
2809
  const logger = globalThis.AI_SDK_LOG_WARNINGS;
2798
2810
  if (logger !== false && typeof logger !== "function") {
2799
2811
  console.warn(
2800
- "[openrouter] Some reasoning_details entries were removed because they were missing signatures. See https://github.com/OpenRouterTeam/ai-sdk-provider/issues/423 for more details."
2812
+ "[openrouter] Some reasoning_details entries were removed because they were missing signatures. See https://github.com/OpenRouterTeam/ai-sdk-provider/issues/423 and https://github.com/OpenRouterTeam/ai-sdk-provider/issues/418 for more details."
2801
2813
  );
2802
2814
  }
2803
2815
  }
@@ -2861,7 +2873,7 @@ function getToolResultContent(input) {
2861
2873
  }
2862
2874
  function mapToolResultContentParts(parts) {
2863
2875
  return parts.map((part) => {
2864
- var _a16, _b16, _c;
2876
+ var _a16, _b16, _c, _d;
2865
2877
  switch (part.type) {
2866
2878
  case "text":
2867
2879
  return { type: "text", text: part.text };
@@ -2893,7 +2905,13 @@ function mapToolResultContentParts(parts) {
2893
2905
  image_url: { url: dataUrl }
2894
2906
  };
2895
2907
  }
2896
- if ((_b16 = part.mediaType) == null ? void 0 : _b16.startsWith("audio/")) {
2908
+ if ((_b16 = part.mediaType) == null ? void 0 : _b16.startsWith("video/")) {
2909
+ return {
2910
+ type: "video_url",
2911
+ video_url: { url: dataUrl }
2912
+ };
2913
+ }
2914
+ if ((_c = part.mediaType) == null ? void 0 : _c.startsWith("audio/")) {
2897
2915
  const rawFormat = part.mediaType.replace("audio/", "");
2898
2916
  const format = MIME_TO_FORMAT[rawFormat];
2899
2917
  if (format !== void 0) {
@@ -2909,7 +2927,7 @@ function mapToolResultContentParts(parts) {
2909
2927
  return {
2910
2928
  type: "file",
2911
2929
  file: {
2912
- filename: (_c = part.filename) != null ? _c : "",
2930
+ filename: (_d = part.filename) != null ? _d : "",
2913
2931
  file_data: dataUrl
2914
2932
  }
2915
2933
  };
@@ -3518,7 +3536,8 @@ var OpenRouterChatLanguageModel = class {
3518
3536
  response: {
3519
3537
  id: response.id,
3520
3538
  modelId: response.model,
3521
- headers: responseHeaders
3539
+ headers: responseHeaders,
3540
+ body: response
3522
3541
  }
3523
3542
  };
3524
3543
  }