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