@cldmv/llm-translator 0.8.0 → 0.10.0

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 (167) hide show
  1. package/README.md +9 -7
  2. package/dist/api/convert/anthropic/messages/to/ollama/chat/request.mjs +2 -0
  3. package/dist/api/convert/anthropic/messages/to/openai/chat/request.mjs +8 -8
  4. package/dist/api/convert/ollama/chat/to/anthropic/messages/response.mjs +2 -0
  5. package/dist/api/convert/ollama/chat/to/anthropic/messages/stream.mjs +2 -0
  6. package/dist/api/convert/ollama/chat/to/openai/chat/response.mjs +2 -0
  7. package/dist/api/convert/ollama/chat/to/openai/chat/stream.mjs +2 -0
  8. package/dist/api/convert/openai/chat/to/ollama/chat/request.mjs +2 -0
  9. package/dist/api/detect.mjs +1 -1
  10. package/dist/api/driver/azure/detect.mjs +2 -0
  11. package/dist/api/driver/azure/error.mjs +2 -0
  12. package/dist/api/driver/azure/info.mjs +2 -0
  13. package/dist/api/driver/azure/model/list.mjs +2 -0
  14. package/dist/api/driver/azure/path.mjs +2 -0
  15. package/dist/api/driver/azure/request.mjs +2 -0
  16. package/dist/api/driver/azure/settings.mjs +2 -0
  17. package/dist/api/driver/fireworks/detect.mjs +2 -0
  18. package/dist/api/driver/fireworks/info.mjs +2 -0
  19. package/dist/api/driver/fireworks/path.mjs +2 -0
  20. package/dist/api/driver/fireworks/request.mjs +2 -0
  21. package/dist/api/driver/fireworks/settings.mjs +2 -0
  22. package/dist/api/driver/gemini/detect.mjs +2 -0
  23. package/dist/api/driver/gemini/info.mjs +2 -0
  24. package/dist/api/driver/gemini/path.mjs +2 -0
  25. package/dist/api/driver/gemini/request.mjs +2 -0
  26. package/dist/api/driver/gemini/settings.mjs +2 -0
  27. package/dist/api/driver/groq/detect.mjs +2 -0
  28. package/dist/api/driver/groq/info.mjs +2 -0
  29. package/dist/api/driver/groq/path.mjs +2 -0
  30. package/dist/api/driver/groq/request.mjs +2 -0
  31. package/dist/api/driver/groq/settings.mjs +2 -0
  32. package/dist/api/driver/localai/chunk.mjs +2 -0
  33. package/dist/api/driver/localai/detect.mjs +2 -0
  34. package/dist/api/driver/localai/info.mjs +2 -0
  35. package/dist/api/driver/localai/request.mjs +2 -0
  36. package/dist/api/driver/localai/response.mjs +2 -0
  37. package/dist/api/driver/localai/settings.mjs +2 -0
  38. package/dist/api/driver/ollama/info.mjs +1 -1
  39. package/dist/api/driver/ollama/request.mjs +1 -1
  40. package/dist/api/driver/openrouter/chunk.mjs +2 -0
  41. package/dist/api/driver/openrouter/detect.mjs +2 -0
  42. package/dist/api/driver/openrouter/info.mjs +2 -0
  43. package/dist/api/driver/openrouter/path.mjs +2 -0
  44. package/dist/api/driver/openrouter/request.mjs +2 -0
  45. package/dist/api/driver/openrouter/response.mjs +2 -0
  46. package/dist/api/driver/openrouter/settings.mjs +2 -0
  47. package/dist/api/driver/tgi/chunk.mjs +2 -0
  48. package/dist/api/driver/tgi/detect.mjs +2 -0
  49. package/dist/api/driver/tgi/info.mjs +2 -0
  50. package/dist/api/driver/tgi/request.mjs +2 -0
  51. package/dist/api/driver/tgi/response.mjs +2 -0
  52. package/dist/api/driver/tgi/settings.mjs +2 -0
  53. package/dist/api/driver/together/detect.mjs +2 -0
  54. package/dist/api/driver/together/info.mjs +2 -0
  55. package/dist/api/driver/together/request.mjs +2 -0
  56. package/dist/api/driver/together/settings.mjs +2 -0
  57. package/dist/api/driver/vllm/detect.mjs +1 -1
  58. package/dist/api/driver/vllm/info.mjs +1 -1
  59. package/dist/api/driver/vllm/model/list.mjs +1 -1
  60. package/dist/api/driver/xai/detect.mjs +2 -0
  61. package/dist/api/driver/xai/info.mjs +2 -0
  62. package/dist/api/driver/xai/request.mjs +2 -0
  63. package/dist/api/driver/xai/settings.mjs +2 -0
  64. package/dist/api/embeddings/send.mjs +1 -1
  65. package/dist/api/health/check.mjs +2 -0
  66. package/dist/api/model/list.mjs +1 -1
  67. package/dist/api/request.mjs +2 -2
  68. package/dist/api/response.mjs +1 -1
  69. package/dist/api/send.mjs +1 -1
  70. package/dist/api/status.mjs +1 -1
  71. package/dist/api/stream.mjs +1 -1
  72. package/dist/index.mjs +1 -1
  73. package/dist/lib/azure.mjs +2 -0
  74. package/dist/lib/backends.mjs +1 -1
  75. package/dist/lib/capture.mjs +1 -1
  76. package/dist/lib/config.mjs +1 -1
  77. package/dist/lib/health.mjs +2 -0
  78. package/dist/lib/http.mjs +1 -1
  79. package/dist/lib/models.mjs +1 -1
  80. package/dist/lib/ndjson.mjs +4 -0
  81. package/dist/lib/ollama.mjs +3 -0
  82. package/dist/lib/openrouter.mjs +2 -0
  83. package/dist/lib/pool.mjs +1 -1
  84. package/dist/lib/presets.mjs +2 -0
  85. package/dist/lib/route.mjs +1 -1
  86. package/dist/lib/settings.mjs +1 -1
  87. package/dist/lib/tgi.mjs +2 -0
  88. package/dist/lib/vllm.mjs +4 -0
  89. package/package.json +1 -1
  90. package/types/src/api/convert/anthropic/messages/to/ollama/chat/request.d.mts +14 -0
  91. package/types/src/api/convert/ollama/chat/to/anthropic/messages/response.d.mts +10 -0
  92. package/types/src/api/convert/ollama/chat/to/anthropic/messages/stream.d.mts +14 -0
  93. package/types/src/api/convert/ollama/chat/to/openai/chat/response.d.mts +10 -0
  94. package/types/src/api/convert/ollama/chat/to/openai/chat/stream.d.mts +13 -0
  95. package/types/src/api/convert/openai/chat/to/ollama/chat/request.d.mts +12 -0
  96. package/types/src/api/driver/azure/detect.d.mts +8 -0
  97. package/types/src/api/driver/azure/error.d.mts +15 -0
  98. package/types/src/api/driver/azure/info.d.mts +31 -0
  99. package/types/src/api/driver/azure/model/list.d.mts +7 -0
  100. package/types/src/api/driver/azure/path.d.mts +7 -0
  101. package/types/src/api/driver/azure/request.d.mts +8 -0
  102. package/types/src/api/driver/azure/settings.d.mts +23 -0
  103. package/types/src/api/driver/fireworks/detect.d.mts +8 -0
  104. package/types/src/api/driver/fireworks/info.d.mts +13 -0
  105. package/types/src/api/driver/fireworks/path.d.mts +7 -0
  106. package/types/src/api/driver/fireworks/request.d.mts +7 -0
  107. package/types/src/api/driver/fireworks/settings.d.mts +5 -0
  108. package/types/src/api/driver/gemini/detect.d.mts +8 -0
  109. package/types/src/api/driver/gemini/info.d.mts +13 -0
  110. package/types/src/api/driver/gemini/path.d.mts +7 -0
  111. package/types/src/api/driver/gemini/request.d.mts +7 -0
  112. package/types/src/api/driver/gemini/settings.d.mts +5 -0
  113. package/types/src/api/driver/groq/detect.d.mts +8 -0
  114. package/types/src/api/driver/groq/info.d.mts +13 -0
  115. package/types/src/api/driver/groq/path.d.mts +7 -0
  116. package/types/src/api/driver/groq/request.d.mts +7 -0
  117. package/types/src/api/driver/groq/settings.d.mts +5 -0
  118. package/types/src/api/driver/localai/chunk.d.mts +25 -0
  119. package/types/src/api/driver/localai/detect.d.mts +6 -0
  120. package/types/src/api/driver/localai/info.d.mts +33 -0
  121. package/types/src/api/driver/localai/request.d.mts +10 -0
  122. package/types/src/api/driver/localai/response.d.mts +26 -0
  123. package/types/src/api/driver/localai/settings.d.mts +25 -0
  124. package/types/src/api/driver/ollama/info.d.mts +7 -2
  125. package/types/src/api/driver/openrouter/chunk.d.mts +25 -0
  126. package/types/src/api/driver/openrouter/detect.d.mts +26 -0
  127. package/types/src/api/driver/openrouter/info.d.mts +30 -0
  128. package/types/src/api/driver/openrouter/path.d.mts +8 -0
  129. package/types/src/api/driver/openrouter/request.d.mts +10 -0
  130. package/types/src/api/driver/openrouter/response.d.mts +8 -0
  131. package/types/src/api/driver/openrouter/settings.d.mts +26 -0
  132. package/types/src/api/driver/tgi/chunk.d.mts +9 -0
  133. package/types/src/api/driver/tgi/detect.d.mts +6 -0
  134. package/types/src/api/driver/tgi/info.d.mts +33 -0
  135. package/types/src/api/driver/tgi/request.d.mts +9 -0
  136. package/types/src/api/driver/tgi/response.d.mts +9 -0
  137. package/types/src/api/driver/tgi/settings.d.mts +25 -0
  138. package/types/src/api/driver/together/detect.d.mts +8 -0
  139. package/types/src/api/driver/together/info.d.mts +13 -0
  140. package/types/src/api/driver/together/request.d.mts +7 -0
  141. package/types/src/api/driver/together/settings.d.mts +5 -0
  142. package/types/src/api/driver/vllm/detect.d.mts +1 -1
  143. package/types/src/api/driver/vllm/info.d.mts +1 -1
  144. package/types/src/api/driver/vllm/model/list.d.mts +3 -1
  145. package/types/src/api/driver/xai/detect.d.mts +8 -0
  146. package/types/src/api/driver/xai/info.d.mts +13 -0
  147. package/types/src/api/driver/xai/request.d.mts +7 -0
  148. package/types/src/api/driver/xai/settings.d.mts +5 -0
  149. package/types/src/api/endpoint/status.d.mts +5 -2
  150. package/types/src/api/health/check.d.mts +8 -0
  151. package/types/src/api/status.d.mts +1 -1
  152. package/types/src/lib/azure.d.mts +17 -0
  153. package/types/src/lib/backends.d.mts +22 -0
  154. package/types/src/lib/config.d.mts +12 -0
  155. package/types/src/lib/events.d.mts +2 -2
  156. package/types/src/lib/health.d.mts +22 -0
  157. package/types/src/lib/http.d.mts +13 -2
  158. package/types/src/lib/models.d.mts +27 -2
  159. package/types/src/lib/ndjson.d.mts +16 -0
  160. package/types/src/lib/ollama.d.mts +86 -0
  161. package/types/src/lib/openrouter.d.mts +23 -0
  162. package/types/src/lib/pool.d.mts +30 -4
  163. package/types/src/lib/presets.d.mts +98 -0
  164. package/types/src/lib/route.d.mts +1 -1
  165. package/types/src/lib/settings.d.mts +5 -0
  166. package/types/src/lib/tgi.d.mts +33 -0
  167. package/types/src/lib/vllm.d.mts +47 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Match by host name, no network access.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not Fireworks AI's.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Describe the Fireworks AI driver (see `PRESETS.fireworks` in `lib/presets.mjs`).
3
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
+ */
5
+ export function info(): {
6
+ name: string;
7
+ protocol: string;
8
+ order: number;
9
+ auth: string;
10
+ strict: boolean;
11
+ fields?: string[];
12
+ paths: Record<string, string>;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Put the calls under the provider's path root, unless the upstream URL already ends in it.
3
+ * @param {"chat" | "embeddings" | "models"} kind - Which call.
4
+ * @param {any} context - `{ endpoint }`.
5
+ * @returns {string} Path starting with `/`.
6
+ */
7
+ export function path(kind: "chat" | "embeddings" | "models", { endpoint }: any): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drop tool fields when there are no tools, and the fields Fireworks AI rejects (each recorded in `state.dropped`).
3
+ * @param {any} body - Chat Completions request body.
4
+ * @param {any} [context] - `{ state }`.
5
+ * @returns {any} Normalized body.
6
+ */
7
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings for Fireworks AI: token field, reasoning field and controls, sampling fields and streaming usage as the provider documents them (see `PRESETS.fireworks` in `lib/presets.mjs`).
3
+ * @returns {any} Partial settings.
4
+ */
5
+ export function settings(): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Match by host name, no network access.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not Gemini (OpenAI-compatible endpoint)'s.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Describe the Gemini (OpenAI-compatible endpoint) driver (see `PRESETS.gemini` in `lib/presets.mjs`).
3
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
+ */
5
+ export function info(): {
6
+ name: string;
7
+ protocol: string;
8
+ order: number;
9
+ auth: string;
10
+ strict: boolean;
11
+ fields?: string[];
12
+ paths: Record<string, string>;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Put the calls under the provider's path root, unless the upstream URL already ends in it.
3
+ * @param {"chat" | "embeddings" | "models"} kind - Which call.
4
+ * @param {any} context - `{ endpoint }`.
5
+ * @returns {string} Path starting with `/`.
6
+ */
7
+ export function path(kind: "chat" | "embeddings" | "models", { endpoint }: any): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drop tool fields when there are no tools, and the fields Gemini (OpenAI-compatible endpoint) rejects (each recorded in `state.dropped`).
3
+ * @param {any} body - Chat Completions request body.
4
+ * @param {any} [context] - `{ state }`.
5
+ * @returns {any} Normalized body.
6
+ */
7
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings for Gemini (OpenAI-compatible endpoint): token field, reasoning field and controls, sampling fields and streaming usage as the provider documents them (see `PRESETS.gemini` in `lib/presets.mjs`).
3
+ * @returns {any} Partial settings.
4
+ */
5
+ export function settings(): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Match by host name, no network access.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not Groq's.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Describe the Groq driver (see `PRESETS.groq` in `lib/presets.mjs`).
3
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
+ */
5
+ export function info(): {
6
+ name: string;
7
+ protocol: string;
8
+ order: number;
9
+ auth: string;
10
+ strict: boolean;
11
+ fields?: string[];
12
+ paths: Record<string, string>;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Put the calls under the provider's path root, unless the upstream URL already ends in it.
3
+ * @param {"chat" | "embeddings" | "models"} kind - Which call.
4
+ * @param {any} context - `{ endpoint }`.
5
+ * @returns {string} Path starting with `/`.
6
+ */
7
+ export function path(kind: "chat" | "embeddings" | "models", { endpoint }: any): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drop tool fields when there are no tools, and the fields Groq rejects (each recorded in `state.dropped`).
3
+ * @param {any} body - Chat Completions request body.
4
+ * @param {any} [context] - `{ state }`.
5
+ * @returns {any} Normalized body.
6
+ */
7
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings for Groq: token field, reasoning field and controls, sampling fields and streaming usage as the provider documents them (see `PRESETS.groq` in `lib/presets.mjs`).
3
+ * @returns {any} Partial settings.
4
+ */
5
+ export function settings(): any;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/localai/chunk.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview LocalAI driver: streaming chunk normalizer (Chat Completions chunk).
17
+ * @module @cldmv/llm-translator/driver/localai
18
+ */
19
+ /**
20
+ * When the client asked for one tool call at a time, drop the fragments of every call but the first (index 0), see `response`.
21
+ * @param {any} chunk - Parsed `chat.completion.chunk`.
22
+ * @param {any} [ctx] - `{ state }`.
23
+ * @returns {any} Normalized chunk.
24
+ */
25
+ export function chunk(chunk: any, ctx?: any): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Probe an endpoint for LocalAI.
3
+ * @param {any} context - `{ endpoint, transport, signal, timeout, probes }`.
4
+ * @returns {Promise<any | null>} Facts `{ version, models }`, or null when the endpoint is not LocalAI.
5
+ */
6
+ export function detect(context: any): Promise<any | null>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/localai/info.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview LocalAI driver: static facts about the LocalAI server.
17
+ * @module @cldmv/llm-translator/driver/localai
18
+ */
19
+ /**
20
+ * Describe the LocalAI driver. It is found through `GET /version` (`{ version: "v3.1.0 (<commit>)" }`) or LocalAI's discovery document at
21
+ * `GET /.well-known/localai.json`. The extra fields are the ones LocalAI's request schema accepts beyond the OpenAI set.
22
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
23
+ */
24
+ export function info(): {
25
+ name: string;
26
+ protocol: string;
27
+ order: number;
28
+ auth: string;
29
+ strict: boolean;
30
+ probes: string[];
31
+ fields: string[];
32
+ paths: Record<string, string>;
33
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Drop tool fields when there are no tools; rename vLLM's `repetition_penalty` to LocalAI's `repeat_penalty`; and take over
3
+ * `parallel_tool_calls: false`. LocalAI does not read that field: whether a model may call several tools in one turn is its YAML
4
+ * `function.parallel_calls`. When the client asked for one call at a time (the Anthropic front's `disable_parallel_tool_use`), the field
5
+ * is removed and `state.localaiSingleCall` makes the response normalizers keep only the first call.
6
+ * @param {any} body - Chat Completions request body.
7
+ * @param {any} [ctx] - `{ state }`.
8
+ * @returns {any} Normalized body.
9
+ */
10
+ export function request(body: any, ctx?: any): any;
@@ -0,0 +1,26 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/localai/response.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview LocalAI driver: response normalizer (Chat Completions body).
17
+ * @module @cldmv/llm-translator/driver/localai
18
+ */
19
+ /**
20
+ * When the client asked for one tool call at a time, keep only the first call of each choice: LocalAI decides by model configuration
21
+ * (`function.parallel_calls`) and ignores the request, so a model configured for parallel calls can still return several.
22
+ * @param {any} body - Chat Completions response body.
23
+ * @param {any} [ctx] - `{ state }`.
24
+ * @returns {any} Normalized body.
25
+ */
26
+ export function response(body: any, ctx?: any): any;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/localai/settings.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview LocalAI driver: translator settings for LocalAI servers.
17
+ * @module @cldmv/llm-translator/driver/localai
18
+ */
19
+ /**
20
+ * Settings for LocalAI: reasoning is sent as `reasoning` (LocalAI's own field; it reads `reasoning_content` too, and so does the
21
+ * translator), `max_tokens` as the output cap, `top_k` and `chat_template_kwargs` are accepted, no prefill continuation, and usage on
22
+ * the last content chunk when `stream_options.include_usage` is set.
23
+ * @returns {any} Partial settings.
24
+ */
25
+ export function settings(): any;
@@ -17,8 +17,9 @@
17
17
  * @module @cldmv/llm-translator/driver/ollama
18
18
  */
19
19
  /**
20
- * Describe the Ollama driver.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], paths: Record<string,string>}} Driver facts.
20
+ * Describe the Ollama driver. `protocol` is the OpenAI-compatible `/v1` API; `native` is the mode an upstream selects with `api: "native"`, Ollama's own
21
+ * `/api/chat` (the `ollama.chat` protocol; the model list and embeddings stay on `/v1`).
22
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], paths: Record<string,string>, native: {protocol: string, paths: Record<string,string>}}} Driver facts.
22
23
  */
23
24
  export function info(): {
24
25
  name: string;
@@ -28,4 +29,8 @@ export function info(): {
28
29
  strict: boolean;
29
30
  probes: string[];
30
31
  paths: Record<string, string>;
32
+ native: {
33
+ protocol: string;
34
+ paths: Record<string, string>;
35
+ };
31
36
  };
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/openrouter/chunk.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview OpenRouter driver: streaming chunk normalizer (Chat Completions chunk).
17
+ * @module @cldmv/llm-translator/driver/openrouter
18
+ */
19
+ /**
20
+ * Give an error that sits on a choice the top-level `error` the stream converter and OpenRouter's own mid-stream errors use, so the Anthropic
21
+ * front ends the stream with an `error` event carrying the provider's message. A chunk that already has an `error` or no choice error passes unchanged.
22
+ * @param {any} chunk - Parsed `chat.completion.chunk`.
23
+ * @returns {any} Normalized chunk.
24
+ */
25
+ export function chunk(chunk: any): any;
@@ -0,0 +1,26 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/openrouter/detect.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview OpenRouter driver: matches the openrouter.ai host.
17
+ * @module @cldmv/llm-translator/driver/openrouter
18
+ */
19
+ /**
20
+ * Match by host name, no network access.
21
+ * @param {any} context - `{ endpoint }`.
22
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not openrouter.ai.
23
+ */
24
+ export function detect({ endpoint }: any): {
25
+ host: string;
26
+ } | null;
@@ -0,0 +1,30 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/openrouter/info.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview OpenRouter driver: static facts about the hosted OpenRouter API.
17
+ * @module @cldmv/llm-translator/driver/openrouter
18
+ */
19
+ /**
20
+ * Describe the OpenRouter driver. The API lives under `/api`; the `path` leaf adds it, so `paths` holds the usual `/v1/...` ones.
21
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, paths: Record<string,string>}} Driver facts.
22
+ */
23
+ export function info(): {
24
+ name: string;
25
+ protocol: string;
26
+ order: number;
27
+ auth: string;
28
+ strict: boolean;
29
+ paths: Record<string, string>;
30
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Put the calls under `/api`, so the upstream can be given as `https://openrouter.ai` or `https://openrouter.ai/api` (a trailing `/v1` is removed
3
+ * by the config).
4
+ * @param {"chat" | "embeddings" | "models"} kind - Which call.
5
+ * @param {any} context - `{ endpoint }`.
6
+ * @returns {string} Path starting with `/`.
7
+ */
8
+ export function path(kind: "chat" | "embeddings" | "models", { endpoint }: any): string;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Drop empty tool fields and express the reasoning controls the way OpenRouter takes them: a `reasoning` object with either `effort` or
3
+ * `max_tokens`, never both. A `reasoning` object the client sent itself is kept as it is (its `reasoning_effort` sibling is removed). Otherwise
4
+ * `reasoning_effort` becomes `reasoning: { effort }`, and an Anthropic request that enabled thinking with a `budget_tokens` and no effort
5
+ * becomes `reasoning: { max_tokens }`, capped below the request's `max_tokens`.
6
+ * @param {any} body - Chat Completions request body.
7
+ * @param {any} [context] - `{ state }`; `state.thinkingBudget` is the thinking budget of an Anthropic request.
8
+ * @returns {any} Normalized body.
9
+ */
10
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Turn an error OpenRouter sent with HTTP 200 into an upstream error: `choices[i].error` on every choice, or a top-level `error` and no choices.
3
+ * Any partial text of the failed choice is dropped. A reply with a choice that did not fail passes unchanged.
4
+ * @param {any} body - Parsed `chat.completion`.
5
+ * @returns {any} The body.
6
+ * @throws {import("../../../lib/errors.mjs").TranslatorError} With the error's `message` and its `code` as the HTTP status.
7
+ */
8
+ export function response(body: any): any;
@@ -0,0 +1,26 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/openrouter/settings.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview OpenRouter driver: translator settings for the hosted OpenRouter API.
17
+ * @module @cldmv/llm-translator/driver/openrouter
18
+ */
19
+ /**
20
+ * Settings for openrouter.ai: reasoning comes back in `reasoning` and `reasoning_details`, and `reasoning_details` is sent back unmodified and in
21
+ * order (`reasoningRoundTrip`). Thinking and effort are sent as `reasoning_effort`, which the `request` normalizer turns into OpenRouter's
22
+ * `reasoning` object. `max_tokens` is the output cap, `top_k` is accepted (OpenRouter drops what a model does not support), a trailing assistant
23
+ * message is OpenRouter's own prefill, and usage comes in a final chunk.
24
+ * @returns {any} Partial settings.
25
+ */
26
+ export function settings(): any;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Put a streamed TGI chunk into the OpenAI shape: `delta.tool_calls` as one object becomes a list, numeric ids become strings, object
3
+ * `arguments` become a JSON string, an empty id (TGI repeats the field on every fragment) is removed so the fragment continues the open
4
+ * call, and `eos_token` / `stop_sequence` finish reasons become `stop` (or `tool_calls` once the stream carried calls).
5
+ * @param {any} chunk - Parsed `chat.completion.chunk`.
6
+ * @param {any} [ctx] - `{ state }`; remembers whether the stream carried tool calls.
7
+ * @returns {any} Normalized chunk.
8
+ */
9
+ export function chunk(chunk: any, ctx?: any): any;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Probe an endpoint for Text Generation Inference.
3
+ * @param {any} context - `{ endpoint, transport, signal, timeout, probes }`.
4
+ * @returns {Promise<any | null>} Facts `{ version, model, maxInputTokens, maxTotalTokens }`, or null when the endpoint is not TGI.
5
+ */
6
+ export function detect(context: any): Promise<any | null>;
@@ -0,0 +1,33 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/tgi/info.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview Hugging Face TGI driver: static facts about Text Generation Inference.
17
+ * @module @cldmv/llm-translator/driver/tgi
18
+ */
19
+ /**
20
+ * Describe the TGI driver. It is found through `GET /info`, TGI's router description. `grammar` is allowed through the OpenAI front's
21
+ * request filter because the request normalizer folds it into `response_format`, the only place the chat endpoint reads a grammar.
22
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
23
+ */
24
+ export function info(): {
25
+ name: string;
26
+ protocol: string;
27
+ order: number;
28
+ auth: string;
29
+ strict: boolean;
30
+ probes: string[];
31
+ fields: string[];
32
+ paths: Record<string, string>;
33
+ };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Drop tool fields when there are no tools; fold a client's `grammar` into `response_format` (the chat endpoint reads a grammar only
3
+ * there) and rewrite `response_format` into TGI's shape; and drop `response_format` when the request also has tools, which TGI refuses
4
+ * (the tools win, and the drop is recorded in `state.dropped`).
5
+ * @param {any} body - Chat Completions request body.
6
+ * @param {any} [ctx] - `{ state }`.
7
+ * @returns {any} Normalized body.
8
+ */
9
+ export function request(body: any, ctx?: any): any;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Put TGI's historic deviations into the OpenAI shape: `tool_calls` as one object becomes a list, numeric tool-call ids become strings,
3
+ * object `arguments` (or `parameters`) become a JSON string, `eos_token` and `stop_sequence` finish reasons become `stop` (or `tool_calls`
4
+ * when the answer holds calls), and the `text_completion` object name becomes `chat.completion`. Current TGI already answers in the
5
+ * standard shape, which passes through unchanged.
6
+ * @param {any} body - Chat Completions response body.
7
+ * @returns {any} Normalized body.
8
+ */
9
+ export function response(body: any): any;
@@ -0,0 +1,25 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/tgi/settings.mjs
5
+ * @Date: 2026-11-13T09:00:00-08:00 (1794589200)
6
+ * @Author: Nate Corcoran <CLDMV>
7
+ * @Email: <Shinrai@users.noreply.github.com>
8
+ * -----
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-11-13T09:00:00-08:00 (1794589200)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview Hugging Face TGI driver: translator settings for TGI servers.
17
+ * @module @cldmv/llm-translator/driver/tgi
18
+ */
19
+ /**
20
+ * Settings for TGI: `max_tokens` as the output cap, no `top_k` (the chat request has none), no prefill continuation, no thinking switch,
21
+ * and `response_format` for structured output (the request normalizer rewrites it into TGI's grammar shape). Usage comes on the last
22
+ * content chunk when `stream_options.include_usage` is set.
23
+ * @returns {any} Partial settings.
24
+ */
25
+ export function settings(): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Match by host name, no network access.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not Together AI's.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Describe the Together AI driver (see `PRESETS.together` in `lib/presets.mjs`).
3
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
+ */
5
+ export function info(): {
6
+ name: string;
7
+ protocol: string;
8
+ order: number;
9
+ auth: string;
10
+ strict: boolean;
11
+ fields?: string[];
12
+ paths: Record<string, string>;
13
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Drop tool fields when there are no tools, and the fields Together AI rejects (each recorded in `state.dropped`).
3
+ * @param {any} body - Chat Completions request body.
4
+ * @param {any} [context] - `{ state }`.
5
+ * @returns {any} Normalized body.
6
+ */
7
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Settings for Together AI: token field, reasoning field and controls, sampling fields and streaming usage as the provider documents them (see `PRESETS.together` in `lib/presets.mjs`).
3
+ * @returns {any} Partial settings.
4
+ */
5
+ export function settings(): any;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Probe an endpoint for vLLM.
3
3
  * @param {any} context - `{ endpoint, transport, signal, timeout, probes }`.
4
- * @returns {Promise<any | null>} Facts `{ version, models, maxModelLen }`, or null when the endpoint is not vLLM (or is SGLang or llama.cpp, which also answer `/version`).
4
+ * @returns {Promise<any | null>} Facts `{ version, models, adapters, maxModelLen }` (`models` lists the base models and the LoRA adapters, `adapters` the adapters alone as `{ id, parent }`, taken from the entries whose `parent` names the base model), or null when the endpoint is not vLLM (or is LocalAI, SGLang, llama.cpp or TGI, which can also answer `/version`).
5
5
  */
6
6
  export function detect({ endpoint, transport, signal, timeout, probes }: any): Promise<any | null>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Describe the vLLM driver.
2
+ * Describe the vLLM driver. `paths.health` (`GET /health`: 200 when the engine is up, 503 once it is dead; outside the API-key guard) is what `lib/health` probes before routing a request to a pool.
3
3
  * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
@@ -1,5 +1,7 @@
1
1
  /**
2
- * List the models the vLLM server serves (including `max_model_len`).
2
+ * List the models the vLLM server serves (including `max_model_len`, and `parent` on a LoRA adapter). What the server answers is also what the
3
+ * upstream serves from now on: adapters loaded at runtime (`/v1/load_lora_adapter`) become routable, and unloaded ones stop being. An upstream
4
+ * with a configured `models` list keeps that list.
3
5
  * @param {any} context - `{ endpoint, transport, signal, timeout }`.
4
6
  * @returns {Promise<any[] | null>} Models, or null when unreachable.
5
7
  */
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Match by host name, no network access.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string} | null} Facts, or null when the endpoint is not xAI's.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;