@codeproxy/core 0.1.2 → 0.1.4

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
@@ -1793,6 +1793,15 @@ function inferFormatFromUrl(baseUrl) {
1793
1793
  }
1794
1794
  return null;
1795
1795
  }
1796
+ function inferFormatFromModel(model) {
1797
+ if (!model) {
1798
+ return null;
1799
+ }
1800
+ if (/^claude/i.test(model)) {
1801
+ return "anthropic";
1802
+ }
1803
+ return null;
1804
+ }
1796
1805
  function isResponsesEndpoint(url) {
1797
1806
  try {
1798
1807
  return /\/v1\/responses\/?$/.test(new URL(url, "http://_internal_").pathname);
@@ -1858,7 +1867,7 @@ async function handleResponses(request, format, options, baseFetch, incomingHead
1858
1867
  dropImages = false;
1859
1868
  const fb = options.fallbackUpstream;
1860
1869
  options = { ...options, ...fb, fallbackUpstream: void 0 };
1861
- format = fb.upstreamFormat ?? format;
1870
+ format = fb.upstreamFormat ?? inferFormatFromUrl(fb.baseUrl) ?? inferFormatFromModel(fb.model) ?? format;
1862
1871
  if (options.model) {
1863
1872
  request.model = options.model;
1864
1873
  }