@providerprotocol/ai 0.0.28 → 0.0.31

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.
Files changed (35) hide show
  1. package/dist/anthropic/index.d.ts +11 -0
  2. package/dist/anthropic/index.js +7 -7
  3. package/dist/anthropic/index.js.map +1 -1
  4. package/dist/{chunk-Z6DKC37J.js → chunk-3C7O2RNO.js} +2 -2
  5. package/dist/{chunk-55X3W2MN.js → chunk-3D6XGGVG.js} +9 -2
  6. package/dist/{chunk-55X3W2MN.js.map → chunk-3D6XGGVG.js.map} +1 -1
  7. package/dist/{chunk-QNJO7DSD.js → chunk-4J6OFUKX.js} +10 -1
  8. package/dist/chunk-4J6OFUKX.js.map +1 -0
  9. package/dist/{chunk-SBCATNHA.js → chunk-KUPF5KHT.js} +2 -2
  10. package/dist/{embedding-DtyOFIsS.d.ts → embedding-k7g-BcSY.d.ts} +14 -1
  11. package/dist/google/index.d.ts +4 -0
  12. package/dist/google/index.js +14 -10
  13. package/dist/google/index.js.map +1 -1
  14. package/dist/http/index.d.ts +7 -2
  15. package/dist/http/index.js +9 -5
  16. package/dist/index.d.ts +3 -3
  17. package/dist/index.js +12 -3
  18. package/dist/index.js.map +1 -1
  19. package/dist/ollama/index.js +24 -18
  20. package/dist/ollama/index.js.map +1 -1
  21. package/dist/openai/index.js +8 -11
  22. package/dist/openai/index.js.map +1 -1
  23. package/dist/openrouter/index.d.ts +1 -1
  24. package/dist/openrouter/index.js +6 -4
  25. package/dist/openrouter/index.js.map +1 -1
  26. package/dist/proxy/index.d.ts +1 -1
  27. package/dist/proxy/index.js +2 -2
  28. package/dist/{retry-DXLQnTuU.d.ts → retry-CyAwm_KZ.d.ts} +15 -1
  29. package/dist/xai/index.d.ts +15 -35
  30. package/dist/xai/index.js +11 -14
  31. package/dist/xai/index.js.map +1 -1
  32. package/package.json +1 -1
  33. package/dist/chunk-QNJO7DSD.js.map +0 -1
  34. /package/dist/{chunk-Z6DKC37J.js.map → chunk-3C7O2RNO.js.map} +0 -0
  35. /package/dist/{chunk-SBCATNHA.js.map → chunk-KUPF5KHT.js.map} +0 -0
@@ -201,7 +201,7 @@ interface OpenRouterResponsesParams {
201
201
  * Reasoning configuration
202
202
  */
203
203
  reasoning?: {
204
- effort?: 'low' | 'medium' | 'high';
204
+ effort?: 'low' | 'medium' | 'high' | 'xhigh' | 'minimal' | 'none';
205
205
  };
206
206
  /**
207
207
  * Output modalities for multimodal generation.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseJsonResponse
3
- } from "../chunk-Z6DKC37J.js";
3
+ } from "../chunk-3C7O2RNO.js";
4
4
  import {
5
5
  StreamEventType
6
6
  } from "../chunk-73IIE3QT.js";
@@ -17,7 +17,7 @@ import {
17
17
  } from "../chunk-TOJCZMVU.js";
18
18
  import {
19
19
  resolveApiKey
20
- } from "../chunk-55X3W2MN.js";
20
+ } from "../chunk-3D6XGGVG.js";
21
21
  import {
22
22
  ErrorCode,
23
23
  ModalityType,
@@ -26,7 +26,7 @@ import {
26
26
  doStreamFetch,
27
27
  normalizeHttpError,
28
28
  toError
29
- } from "../chunk-QNJO7DSD.js";
29
+ } from "../chunk-4J6OFUKX.js";
30
30
 
31
31
  // src/providers/openrouter/transform.completions.ts
32
32
  function transformRequest(request, modelId) {
@@ -1608,6 +1608,7 @@ function createResponsesLLMHandler() {
1608
1608
  const baseUrl = request.config.baseUrl ?? OPENROUTER_RESPONSES_API_URL;
1609
1609
  const body = transformRequest2(request, modelId);
1610
1610
  body.stream = true;
1611
+ body.stream_options = { include_usage: true };
1611
1612
  const headers = {
1612
1613
  "Content-Type": "application/json",
1613
1614
  Authorization: `Bearer ${apiKey}`,
@@ -1790,7 +1791,8 @@ function createEmbeddingHandler() {
1790
1791
  index: d.index
1791
1792
  })),
1792
1793
  usage: { totalTokens: data.usage.total_tokens },
1793
- metadata: data.usage.cost !== void 0 ? { cost: data.usage.cost } : void 0
1794
+ // Response metadata namespaced under provider (Spec 15.4)
1795
+ metadata: data.usage.cost !== void 0 ? { openrouter: { cost: data.usage.cost } } : void 0
1794
1796
  };
1795
1797
  }
1796
1798
  };