@inferencesh/sdk 0.6.19 → 0.6.20

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.
@@ -95,14 +95,22 @@ export async function processProxyRequest(adapter, options) {
95
95
  error: "Missing INFERENCE_API_KEY environment variable",
96
96
  });
97
97
  }
98
- // 4. Collect x-inf-* headers to forward
98
+ // 4. Collect headers to forward upstream.
99
+ //
100
+ // x-inf-* plus the SDK's own headers. X-API-Version is load-bearing: the
101
+ // API returns bare DTOs when it sees "2" and the legacy {success, status,
102
+ // data} envelope otherwise, and this SDK only parses the former. Dropping
103
+ // it here made every proxied response unparseable — requests succeeded
104
+ // server-side while the client silently saw nothing.
105
+ const FORWARD_HEADERS = ["x-api-version", "x-client-source"];
99
106
  const forwardHeaders = {};
100
107
  const allHeaders = adapter.headers();
101
108
  for (const [key, value] of Object.entries(allHeaders)) {
102
- if (key.toLowerCase().startsWith("x-inf-")) {
109
+ const lower = key.toLowerCase();
110
+ if (lower.startsWith("x-inf-") || FORWARD_HEADERS.includes(lower)) {
103
111
  const v = firstValue(value);
104
112
  if (v)
105
- forwardHeaders[key.toLowerCase()] = v;
113
+ forwardHeaders[lower] = v;
106
114
  }
107
115
  }
108
116
  // 5. Build request headers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inferencesh/sdk",
3
- "version": "0.6.19",
3
+ "version": "0.6.20",
4
4
  "description": "Official JavaScript/TypeScript SDK for inference.sh - Run AI models with a simple API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",