@ai-sdk/xai 2.0.54 → 2.0.56

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 2.0.56
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8479fe8]
8
+ - Updated dependencies [7aadb9b]
9
+ - @ai-sdk/openai-compatible@1.0.32
10
+
11
+ ## 2.0.55
12
+
13
+ ### Patch Changes
14
+
15
+ - ef70614: fix(xai): make usage nullable in responses schema for streaming compatibility
16
+
3
17
  ## 2.0.54
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -965,7 +965,7 @@ var xaiResponsesResponseSchema = import_v44.z.object({
965
965
  model: import_v44.z.string().nullish(),
966
966
  object: import_v44.z.literal("response"),
967
967
  output: import_v44.z.array(outputItemSchema),
968
- usage: xaiResponsesUsageSchema,
968
+ usage: xaiResponsesUsageSchema.nullish(),
969
969
  status: import_v44.z.string()
970
970
  });
971
971
  var xaiResponsesChunkSchema = import_v44.z.union([
@@ -1813,12 +1813,16 @@ var XaiResponsesLanguageModel = class {
1813
1813
  return {
1814
1814
  content,
1815
1815
  finishReason: mapXaiResponsesFinishReason(response.status),
1816
- usage: {
1816
+ usage: response.usage ? {
1817
1817
  inputTokens: response.usage.input_tokens,
1818
1818
  outputTokens: response.usage.output_tokens,
1819
1819
  totalTokens: response.usage.total_tokens,
1820
1820
  reasoningTokens: (_h = response.usage.output_tokens_details) == null ? void 0 : _h.reasoning_tokens,
1821
1821
  cachedInputTokens: (_i = response.usage.input_tokens_details) == null ? void 0 : _i.cached_tokens
1822
+ } : {
1823
+ inputTokens: 0,
1824
+ outputTokens: 0,
1825
+ totalTokens: 0
1822
1826
  },
1823
1827
  request: { body },
1824
1828
  response: {
@@ -2179,7 +2183,7 @@ var xaiTools = {
2179
2183
  };
2180
2184
 
2181
2185
  // src/version.ts
2182
- var VERSION = true ? "2.0.54" : "0.0.0-test";
2186
+ var VERSION = true ? "2.0.56" : "0.0.0-test";
2183
2187
 
2184
2188
  // src/xai-provider.ts
2185
2189
  var xaiErrorStructure = {