@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.
@@ -2639,7 +2639,7 @@ function convertToOpenRouterChatMessages(prompt) {
2639
2639
  }
2640
2640
  const contentParts = content.map(
2641
2641
  (part, index) => {
2642
- var _a17, _b17, _c2, _d2, _e2, _f2;
2642
+ var _a17, _b17, _c2, _d2, _e2, _f2, _g2;
2643
2643
  const isLastTextPart = part.type === "text" && index === lastTextPartIndex;
2644
2644
  const partCacheControl = getCacheControl(part.providerOptions);
2645
2645
  const cacheControl = part.type === "text" ? partCacheControl != null ? partCacheControl : isLastTextPart ? messageCacheControl : void 0 : partCacheControl;
@@ -2662,14 +2662,26 @@ function convertToOpenRouterChatMessages(prompt) {
2662
2662
  }
2663
2663
  }, cacheControl && { cache_control: cacheControl });
2664
2664
  }
2665
- if ((_b17 = part.mediaType) == null ? void 0 : _b17.startsWith("audio/")) {
2665
+ if ((_b17 = part.mediaType) == null ? void 0 : _b17.startsWith("video/")) {
2666
+ const url = getFileUrl({
2667
+ part,
2668
+ defaultMediaType: "video/mp4"
2669
+ });
2670
+ return __spreadValues({
2671
+ type: "video_url",
2672
+ video_url: {
2673
+ url
2674
+ }
2675
+ }, cacheControl && { cache_control: cacheControl });
2676
+ }
2677
+ if ((_c2 = part.mediaType) == null ? void 0 : _c2.startsWith("audio/")) {
2666
2678
  return __spreadValues({
2667
2679
  type: "input_audio",
2668
2680
  input_audio: getInputAudioData(part)
2669
2681
  }, cacheControl && { cache_control: cacheControl });
2670
2682
  }
2671
2683
  const fileName = String(
2672
- (_f2 = (_e2 = (_d2 = (_c2 = part.providerOptions) == null ? void 0 : _c2.openrouter) == null ? void 0 : _d2.filename) != null ? _e2 : part.filename) != null ? _f2 : ""
2684
+ (_g2 = (_f2 = (_e2 = (_d2 = part.providerOptions) == null ? void 0 : _d2.openrouter) == null ? void 0 : _e2.filename) != null ? _f2 : part.filename) != null ? _g2 : ""
2673
2685
  );
2674
2686
  const fileData = getFileUrl({
2675
2687
  part,
@@ -2754,7 +2766,7 @@ function convertToOpenRouterChatMessages(prompt) {
2754
2766
  return true;
2755
2767
  }
2756
2768
  const format = (_a17 = detail.format) != null ? _a17 : DEFAULT_REASONING_FORMAT;
2757
- if (format !== "anthropic-claude-v1" /* AnthropicClaudeV1 */) {
2769
+ if (format !== "anthropic-claude-v1" /* AnthropicClaudeV1 */ && format !== "google-gemini-v1" /* GoogleGeminiV1 */) {
2758
2770
  return true;
2759
2771
  }
2760
2772
  return !!detail.signature;
@@ -2763,7 +2775,7 @@ function convertToOpenRouterChatMessages(prompt) {
2763
2775
  const logger = globalThis.AI_SDK_LOG_WARNINGS;
2764
2776
  if (logger !== false && typeof logger !== "function") {
2765
2777
  console.warn(
2766
- "[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."
2778
+ "[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."
2767
2779
  );
2768
2780
  }
2769
2781
  }
@@ -2827,7 +2839,7 @@ function getToolResultContent(input) {
2827
2839
  }
2828
2840
  function mapToolResultContentParts(parts) {
2829
2841
  return parts.map((part) => {
2830
- var _a16, _b16, _c;
2842
+ var _a16, _b16, _c, _d;
2831
2843
  switch (part.type) {
2832
2844
  case "text":
2833
2845
  return { type: "text", text: part.text };
@@ -2859,7 +2871,13 @@ function mapToolResultContentParts(parts) {
2859
2871
  image_url: { url: dataUrl }
2860
2872
  };
2861
2873
  }
2862
- if ((_b16 = part.mediaType) == null ? void 0 : _b16.startsWith("audio/")) {
2874
+ if ((_b16 = part.mediaType) == null ? void 0 : _b16.startsWith("video/")) {
2875
+ return {
2876
+ type: "video_url",
2877
+ video_url: { url: dataUrl }
2878
+ };
2879
+ }
2880
+ if ((_c = part.mediaType) == null ? void 0 : _c.startsWith("audio/")) {
2863
2881
  const rawFormat = part.mediaType.replace("audio/", "");
2864
2882
  const format = MIME_TO_FORMAT[rawFormat];
2865
2883
  if (format !== void 0) {
@@ -2875,7 +2893,7 @@ function mapToolResultContentParts(parts) {
2875
2893
  return {
2876
2894
  type: "file",
2877
2895
  file: {
2878
- filename: (_c = part.filename) != null ? _c : "",
2896
+ filename: (_d = part.filename) != null ? _d : "",
2879
2897
  file_data: dataUrl
2880
2898
  }
2881
2899
  };
@@ -3484,7 +3502,8 @@ var OpenRouterChatLanguageModel = class {
3484
3502
  response: {
3485
3503
  id: response.id,
3486
3504
  modelId: response.model,
3487
- headers: responseHeaders
3505
+ headers: responseHeaders,
3506
+ body: response
3488
3507
  }
3489
3508
  };
3490
3509
  }