@cldmv/llm-translator 0.12.0 → 0.14.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 (150) hide show
  1. package/README.md +8 -8
  2. package/dist/api/convert/anthropic/messages/to/bedrock/converse/request.mjs +2 -0
  3. package/dist/api/convert/anthropic/messages/to/openai/responses/request.mjs +2 -0
  4. package/dist/api/convert/bedrock/converse/to/anthropic/messages/response.mjs +2 -0
  5. package/dist/api/convert/bedrock/converse/to/anthropic/messages/stream.mjs +2 -0
  6. package/dist/api/convert/bedrock/converse/to/openai/chat/response.mjs +2 -0
  7. package/dist/api/convert/bedrock/converse/to/openai/chat/stream.mjs +2 -0
  8. package/dist/api/convert/openai/chat/to/bedrock/converse/request.mjs +2 -0
  9. package/dist/api/convert/openai/chat/to/openai/responses/request.mjs +2 -0
  10. package/dist/api/convert/openai/chat/to/openai/responses/response.mjs +2 -0
  11. package/dist/api/convert/openai/chat/to/openai/responses/stream.mjs +2 -0
  12. package/dist/api/convert/openai/responses/to/anthropic/messages/response.mjs +2 -0
  13. package/dist/api/convert/openai/responses/to/anthropic/messages/stream.mjs +2 -0
  14. package/dist/api/convert/openai/responses/to/openai/chat/request.mjs +6 -0
  15. package/dist/api/convert/openai/responses/to/openai/chat/response.mjs +2 -0
  16. package/dist/api/convert/openai/responses/to/openai/chat/stream.mjs +2 -0
  17. package/dist/api/detect.mjs +1 -1
  18. package/dist/api/driver/anthropic/info.mjs +1 -1
  19. package/dist/api/driver/azure/info.mjs +1 -1
  20. package/dist/api/driver/bedrock/detect.mjs +2 -0
  21. package/dist/api/driver/bedrock/info.mjs +2 -0
  22. package/dist/api/driver/bedrock/model/list.mjs +2 -0
  23. package/dist/api/driver/bedrock/path.mjs +2 -0
  24. package/dist/api/driver/bedrock/request.mjs +2 -0
  25. package/dist/api/driver/bedrock/sign.mjs +2 -0
  26. package/dist/api/driver/compatible/info.mjs +1 -1
  27. package/dist/api/driver/deepseek/info.mjs +1 -1
  28. package/dist/api/driver/llamacpp/info.mjs +1 -1
  29. package/dist/api/driver/lmstudio/info.mjs +1 -1
  30. package/dist/api/driver/localai/info.mjs +1 -1
  31. package/dist/api/driver/mistral/info.mjs +1 -1
  32. package/dist/api/driver/ollama/info.mjs +1 -1
  33. package/dist/api/driver/ollama/request.mjs +1 -1
  34. package/dist/api/driver/openai/info.mjs +1 -1
  35. package/dist/api/driver/openrouter/info.mjs +1 -1
  36. package/dist/api/driver/sglang/info.mjs +1 -1
  37. package/dist/api/driver/tgi/info.mjs +1 -1
  38. package/dist/api/driver/vertex/auth.mjs +2 -0
  39. package/dist/api/driver/vertex/detect.mjs +2 -0
  40. package/dist/api/driver/vertex/error.mjs +2 -0
  41. package/dist/api/driver/vertex/info.mjs +2 -0
  42. package/dist/api/driver/vertex/path.mjs +2 -0
  43. package/dist/api/driver/vertex/request.mjs +2 -0
  44. package/dist/api/driver/vertex/settings.mjs +2 -0
  45. package/dist/api/driver/vertex/token/count.mjs +2 -0
  46. package/dist/api/driver/vllm/info.mjs +1 -1
  47. package/dist/api/request.mjs +2 -2
  48. package/dist/api/response.mjs +1 -1
  49. package/dist/api/route.mjs +1 -1
  50. package/dist/api/send.mjs +1 -1
  51. package/dist/api/server/plugin.mjs +1 -1
  52. package/dist/api/status.mjs +1 -1
  53. package/dist/api/stream.mjs +1 -1
  54. package/dist/api/token/count.mjs +1 -1
  55. package/dist/index.mjs +1 -1
  56. package/dist/lib/bedrock.mjs +2 -0
  57. package/dist/lib/capture.mjs +1 -1
  58. package/dist/lib/config.mjs +1 -1
  59. package/dist/lib/converse.mjs +3 -0
  60. package/dist/lib/document-urls.mjs +2 -0
  61. package/dist/lib/documents.mjs +4 -4
  62. package/dist/lib/estimate.mjs +1 -1
  63. package/dist/lib/eventstream.mjs +2 -0
  64. package/dist/lib/fetch-url.mjs +2 -0
  65. package/dist/lib/google-auth.mjs +2 -0
  66. package/dist/lib/http.mjs +1 -1
  67. package/dist/lib/presets.mjs +1 -1
  68. package/dist/lib/protocol.mjs +2 -0
  69. package/dist/lib/responses-upstream.mjs +13 -0
  70. package/dist/lib/responses.mjs +2 -0
  71. package/dist/lib/route.mjs +1 -1
  72. package/dist/lib/routes.mjs +1 -1
  73. package/dist/lib/settings.mjs +1 -1
  74. package/dist/lib/sigv4.mjs +7 -0
  75. package/dist/lib/vertex.mjs +2 -0
  76. package/dist/lib/vllm.mjs +2 -2
  77. package/package.json +1 -1
  78. package/types/src/api/convert/anthropic/messages/to/bedrock/converse/request.d.mts +14 -0
  79. package/types/src/api/convert/anthropic/messages/to/openai/responses/request.d.mts +16 -0
  80. package/types/src/api/convert/bedrock/converse/to/anthropic/messages/response.d.mts +10 -0
  81. package/types/src/api/convert/bedrock/converse/to/anthropic/messages/stream.d.mts +14 -0
  82. package/types/src/api/convert/bedrock/converse/to/openai/chat/response.d.mts +10 -0
  83. package/types/src/api/convert/bedrock/converse/to/openai/chat/stream.d.mts +13 -0
  84. package/types/src/api/convert/openai/chat/to/bedrock/converse/request.d.mts +11 -0
  85. package/types/src/api/convert/openai/chat/to/openai/responses/request.d.mts +12 -0
  86. package/types/src/api/convert/openai/chat/to/openai/responses/response.d.mts +14 -0
  87. package/types/src/api/convert/openai/chat/to/openai/responses/stream.d.mts +18 -0
  88. package/types/src/api/convert/openai/responses/to/anthropic/messages/response.d.mts +8 -0
  89. package/types/src/api/convert/openai/responses/to/anthropic/messages/stream.d.mts +8 -0
  90. package/types/src/api/convert/openai/responses/to/openai/chat/request.d.mts +17 -0
  91. package/types/src/api/convert/openai/responses/to/openai/chat/response.d.mts +8 -0
  92. package/types/src/api/convert/openai/responses/to/openai/chat/stream.d.mts +10 -0
  93. package/types/src/api/driver/anthropic/info.d.mts +2 -1
  94. package/types/src/api/driver/azure/info.d.mts +2 -1
  95. package/types/src/api/driver/bedrock/detect.d.mts +9 -0
  96. package/types/src/api/driver/bedrock/info.d.mts +36 -0
  97. package/types/src/api/driver/bedrock/model/list.d.mts +11 -0
  98. package/types/src/api/driver/bedrock/path.d.mts +9 -0
  99. package/types/src/api/driver/bedrock/request.d.mts +9 -0
  100. package/types/src/api/driver/bedrock/sign.d.mts +9 -0
  101. package/types/src/api/driver/compatible/info.d.mts +2 -1
  102. package/types/src/api/driver/deepseek/info.d.mts +2 -1
  103. package/types/src/api/driver/fireworks/info.d.mts +2 -1
  104. package/types/src/api/driver/gemini/info.d.mts +2 -1
  105. package/types/src/api/driver/groq/info.d.mts +2 -1
  106. package/types/src/api/driver/llamacpp/info.d.mts +2 -1
  107. package/types/src/api/driver/lmstudio/info.d.mts +2 -1
  108. package/types/src/api/driver/localai/info.d.mts +2 -1
  109. package/types/src/api/driver/mistral/info.d.mts +2 -1
  110. package/types/src/api/driver/ollama/info.d.mts +2 -1
  111. package/types/src/api/driver/ollama/request.d.mts +1 -1
  112. package/types/src/api/driver/openai/info.d.mts +2 -1
  113. package/types/src/api/driver/openrouter/info.d.mts +2 -1
  114. package/types/src/api/driver/sglang/info.d.mts +2 -1
  115. package/types/src/api/driver/tgi/info.d.mts +2 -1
  116. package/types/src/api/driver/together/info.d.mts +2 -1
  117. package/types/src/api/driver/vertex/auth.d.mts +7 -0
  118. package/types/src/api/driver/vertex/detect.d.mts +8 -0
  119. package/types/src/api/driver/vertex/error.d.mts +15 -0
  120. package/types/src/api/driver/vertex/info.d.mts +16 -0
  121. package/types/src/api/driver/vertex/path.d.mts +7 -0
  122. package/types/src/api/driver/vertex/request.d.mts +6 -0
  123. package/types/src/api/driver/vertex/settings.d.mts +23 -0
  124. package/types/src/api/driver/vertex/token/count.d.mts +7 -0
  125. package/types/src/api/driver/vllm/info.d.mts +2 -1
  126. package/types/src/api/driver/xai/info.d.mts +2 -1
  127. package/types/src/api/request.d.mts +3 -2
  128. package/types/src/api/route.d.mts +2 -2
  129. package/types/src/api/send.d.mts +1 -1
  130. package/types/src/api/server/plugin.d.mts +1 -1
  131. package/types/src/api/status.d.mts +1 -1
  132. package/types/src/lib/bedrock.d.mts +74 -0
  133. package/types/src/lib/config.d.mts +35 -5
  134. package/types/src/lib/converse.d.mts +81 -0
  135. package/types/src/lib/document-urls.d.mts +55 -0
  136. package/types/src/lib/estimate.d.mts +1 -1
  137. package/types/src/lib/eventstream.d.mts +34 -0
  138. package/types/src/lib/fetch-url.d.mts +64 -0
  139. package/types/src/lib/google-auth.d.mts +58 -0
  140. package/types/src/lib/http.d.mts +5 -3
  141. package/types/src/lib/presets.d.mts +2 -1
  142. package/types/src/lib/protocol.d.mts +87 -0
  143. package/types/src/lib/responses-upstream.d.mts +58 -0
  144. package/types/src/lib/responses.d.mts +72 -0
  145. package/types/src/lib/route.d.mts +7 -3
  146. package/types/src/lib/routes.d.mts +2 -1
  147. package/types/src/lib/settings.d.mts +19 -2
  148. package/types/src/lib/sigv4.d.mts +41 -0
  149. package/types/src/lib/vertex.d.mts +55 -0
  150. package/types/src/lib/vllm.d.mts +4 -4
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Convert ConverseStream events (`{ event, data }` messages, as `lib/eventstream` makes them from the binary frames, or Server-Sent Events text
3
+ * of the same events) to Chat Completions chunks followed by `[DONE]`. Every chunk carries one completion id, tool calls stream their arguments
4
+ * in pieces, and the `metadata` event gives the usage chunk unless `state.includeUsage` is false. A failure message, an event that cannot be read
5
+ * and a stream that ends before `messageStop` each become an `{ error }` chunk followed by `[DONE]`.
6
+ * @param {ReadableStream|AsyncIterable<unknown>|Iterable<unknown>|string|Uint8Array} source - The events.
7
+ * @param {any} [state] - State from the request converter (model, `includeUsage`).
8
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
9
+ * @returns {AsyncGenerator<{ data: any|string }, void, undefined>} Chat Completions chunks.
10
+ */
11
+ export function stream(source: ReadableStream | AsyncIterable<unknown> | Iterable<unknown> | string | Uint8Array, state?: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): AsyncGenerator<{
12
+ data: any | string;
13
+ }, void, undefined>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Convert a Chat Completions request to a Converse body (see `chatBody`). The upstream's `sampling` setting becomes `additionalModelRequestFields`.
3
+ * @param {any} body - Chat Completions request body.
4
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
5
+ * @returns {{body: any, state: any}} The Converse body and the conversion state the response converters read.
6
+ * @throws {TranslatorError} `invalid_request` when `messages` is missing.
7
+ */
8
+ export function request(body: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): {
9
+ body: any;
10
+ state: any;
11
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Convert a Chat Completions request body into a Responses request body (for an OpenAI-protocol client talking to an upstream on the
3
+ * Responses API). See `lib/responses-upstream.mjs` for the mapping.
4
+ * @param {any} chatBody - OpenAI `POST /v1/chat/completions` body.
5
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
6
+ * @returns {Promise<{ body: any, state: any }>} Responses request body and conversion state.
7
+ * @throws {import("../../../../../../../lib/errors.mjs").TranslatorError} For malformed requests, `n` above 1 (`send` fans that out instead), unknown roles, or unknown fields when configured to error.
8
+ */
9
+ export function request(chatBody: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): Promise<{
10
+ body: any;
11
+ state: any;
12
+ }>;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Convert a (non-streaming) Chat Completions reply into a Responses object.
3
+ *
4
+ * The output holds, in this order, a `reasoning` item (the reply's reasoning text as one summary part, and with `reasoningRoundTrip` its
5
+ * `reasoning_details` as `encrypted_content`), a `message` item with an `output_text` part (or a `refusal` part) and one `function_call`
6
+ * item per tool call. A `length` stop makes the response `incomplete` with reason `max_output_tokens`, a content filter one with reason
7
+ * `content_filter`.
8
+ * @param {any} completion - Chat Completions `chat.completion` object.
9
+ * @param {any} state - State from the request converter (`model`, `echo`).
10
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
11
+ * @returns {any} Responses object.
12
+ * @throws {TranslatorError} When the completion has no choices.
13
+ */
14
+ export function response(completion: any, state: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): any;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Convert a Chat Completions chunk stream into Responses events.
3
+ *
4
+ * `source` is SSE text/bytes, an iterable of `{ data }` messages, or bare chunk objects. The result yields `{ event, data }` pairs
5
+ * (`data.type` repeats the event name, `data.sequence_number` counts from 0): `response.created` and `response.in_progress` first, then for each output
6
+ * item `response.output_item.added`, its part and delta events, and `response.output_item.done`, and last `response.completed` (or
7
+ * `response.incomplete` after a length stop or a content filter). Output items come in the order the deltas start them: reasoning
8
+ * (as a summary part), the message text (or refusal) and one function call per tool call index. An `error` chunk, a fatal finish reason or
9
+ * a stream that ends without a finish reason ends with `response.failed`. There is no `[DONE]` sentinel.
10
+ * @param {ReadableStream|AsyncIterable<unknown>|Iterable<unknown>|string|Uint8Array} source - Chat Completions stream.
11
+ * @param {any} state - State from the request converter (`model`, `echo`).
12
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
13
+ * @returns {AsyncGenerator<{ event: string, data: any }, void, undefined>} Responses events.
14
+ */
15
+ export function stream(source: ReadableStream | AsyncIterable<unknown> | Iterable<unknown> | string | Uint8Array, state: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): AsyncGenerator<{
16
+ event: string;
17
+ data: any;
18
+ }, void, undefined>;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert a (non-streaming) Responses reply into an Anthropic message: read as a Chat Completions reply first, then converted from there.
3
+ * @param {any} reply - Responses object.
4
+ * @param {any} [state] - State from the request converter.
5
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
6
+ * @returns {any} Anthropic message.
7
+ */
8
+ export function response(reply: any, state?: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): any;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert a Responses event stream into Anthropic events: read as Chat Completions chunks first, then converted from there.
3
+ * @param {ReadableStream|AsyncIterable<unknown>|Iterable<unknown>|string|Uint8Array} source - Responses stream.
4
+ * @param {any} [state] - State from the request converter.
5
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
6
+ * @returns {AsyncGenerator<any, void, undefined>} Anthropic events.
7
+ */
8
+ export function stream(source: ReadableStream | AsyncIterable<unknown> | Iterable<unknown> | string | Uint8Array, state?: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): AsyncGenerator<any, void, undefined>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Convert an OpenAI Responses request body into a Chat Completions request body, the pivot every upstream is reached through.
3
+ *
4
+ * The core is stateless: `previous_response_id`, `conversation`, `store: true`, `background: true` and stored prompts are refused, and so are hosted tools,
5
+ * non-function `tool_choice` values and input items other than messages, function calls, function call outputs and reasoning items.
6
+ * `instructions` becomes the first system message. Reasoning items are replayed to the upstream only with `reasoningRoundTrip` (their
7
+ * `encrypted_content` carries the `reasoning_details` the converter put there); otherwise they are dropped. Fields without a mapping are
8
+ * dropped and listed in `state.dropped`, or refused when `unknownFields` is `"error"`.
9
+ * @param {any} body - OpenAI `POST /v1/responses` body.
10
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
11
+ * @returns {{ body: any, state: any }} Chat Completions body and the state the reply converters need (`model`, `stream`, `echo`, `dropped`).
12
+ * @throws {TranslatorError} `invalid_request` for a malformed body, `unsupported_field` for stateful parameters and unmapped fields under `unknownFields: "error"`, `unsupported_tool` and `unsupported_content` for what has no counterpart.
13
+ */
14
+ export function request(body: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): {
15
+ body: any;
16
+ state: any;
17
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Convert a (non-streaming) Responses reply into a Chat Completions reply. See `lib/responses-upstream.mjs` for the mapping.
3
+ * @param {any} reply - Responses object.
4
+ * @param {any} [state] - State from the request converter.
5
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
6
+ * @returns {any} Chat completion.
7
+ */
8
+ export function response(reply: any, state?: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): any;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Convert a Responses event stream into Chat Completions chunks followed by `[DONE]`. See `lib/responses-upstream.mjs`.
3
+ * @param {ReadableStream|AsyncIterable<unknown>|Iterable<unknown>|string|Uint8Array} source - Responses stream.
4
+ * @param {any} [state] - State from the request converter.
5
+ * @param {Partial<import("../../../../../../../lib/settings.mjs").Settings>} [settings] - Translator settings.
6
+ * @returns {AsyncGenerator<{ data: any|string }, void, undefined>} Chat chunks.
7
+ */
8
+ export function stream(source: ReadableStream | AsyncIterable<unknown> | Iterable<unknown> | string | Uint8Array, state?: any, settings?: Partial<import("../../../../../../../lib/settings.mjs").Settings>): AsyncGenerator<{
9
+ data: any | string;
10
+ }, void, undefined>;
@@ -18,11 +18,12 @@
18
18
  */
19
19
  /**
20
20
  * Describe the Anthropic driver (native Messages API upstream).
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, hosts: string[], probes: string[], headers: Record<string,string>, paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hosts: string[], probes: string[], headers: Record<string,string>, paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
25
25
  protocol: string;
26
+ protocols: string[];
26
27
  order: number;
27
28
  auth: string;
28
29
  strict: boolean;
@@ -19,11 +19,12 @@
19
19
  /**
20
20
  * Describe the Azure OpenAI driver. The key goes in the `api-key` header. The real paths come from the `path` leaf, because they depend on the
21
21
  * upstream's `apiVersion` and `deployment`; `paths` holds the v1 API paths for a base URL without `/openai`.
22
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, hostSuffixes: string[], paths: Record<string,string>}} Driver facts.
22
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hostSuffixes: string[], paths: Record<string,string>}} Driver facts.
23
23
  */
24
24
  export function info(): {
25
25
  name: string;
26
26
  protocol: string;
27
+ protocols: string[];
27
28
  order: number;
28
29
  auth: string;
29
30
  strict: boolean;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Match by host name, no network access: `bedrock-runtime.<region>.amazonaws.com`, its FIPS and VPC endpoint forms, and the China partition.
3
+ * @param {any} context - `{ endpoint }`.
4
+ * @returns {{host: string, region: string} | null} Facts, or null when the host is not a Bedrock runtime host.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ region: string;
9
+ } | null;
@@ -0,0 +1,36 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/bedrock/info.mjs
5
+ * @Date: 2026-11-19T09:00:00-08:00 (1795107600)
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-19T09:00:00-08:00 (1795107600)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview Amazon Bedrock driver: static facts about the Bedrock runtime.
17
+ * @module @cldmv/llm-translator/driver/bedrock
18
+ */
19
+ /**
20
+ * Describe the Bedrock driver. Claude models go through InvokeModel with an Anthropic Messages body (`anthropic.messages`); every other model
21
+ * goes through Converse (`bedrock.converse`). Under `api: "auto"` the model id chooses (see `lib/capture`). Replies stream as
22
+ * `application/vnd.amazon.eventstream` frames (`frames`). The real paths come from the `path` leaf, because they carry the model id, and the
23
+ * `sign` leaf authenticates every call (a Bedrock API key as a bearer token, or SigV4).
24
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, frames: string, hostSuffixes: string[], paths: Record<string,string>}} Driver facts.
25
+ */
26
+ export function info(): {
27
+ name: string;
28
+ protocol: string;
29
+ protocols: string[];
30
+ order: number;
31
+ auth: string;
32
+ strict: boolean;
33
+ frames: string;
34
+ hostSuffixes: string[];
35
+ paths: Record<string, string>;
36
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * List the foundation models Bedrock reports for the region (`GET /foundation-models` on the control plane, signed like every call). Models that
3
+ * do not produce text are left out. Inference profiles (`us.anthropic.claude-...`, which many models need instead of the bare id) are not
4
+ * listed; name them in the upstream's `models`.
5
+ * @param {any} context - `{ endpoint, transport, signal, timeout }`.
6
+ * @returns {Promise<{id: string, owned_by: string}[] | null>} Models, or null when unreachable, not authenticated or not a model list.
7
+ */
8
+ export function list({ endpoint, transport, signal, timeout }: any): Promise<{
9
+ id: string;
10
+ owned_by: string;
11
+ }[] | null>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Build the path of a call: the model id (percent-encoded as one segment) and the operation. InvokeModel is `/invoke`, or
3
+ * `/invoke-with-response-stream` for a stream; Converse is `/converse`, or `/converse-stream`.
4
+ * @param {"messages" | "converse"} kind - Which call: `messages` is InvokeModel with an Anthropic body.
5
+ * @param {any} context - `{ endpoint, model, stream }`.
6
+ * @returns {string} Path starting with `/model/`.
7
+ * @throws {TranslatorError} `unsupported_endpoint` (501) for any other call (embeddings, chat).
8
+ */
9
+ export function path(kind: "messages" | "converse", { model, stream }: any): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Shape the body for the runtime. The model id and the choice of streaming are in the URL, so neither is in the body. An InvokeModel body
3
+ * also gets `anthropic_version: "bedrock-2023-05-31"` and loses the Anthropic API fields Bedrock does not have (`metadata`, `service_tier`,
4
+ * `container`, `mcp_servers`); a Converse body needs nothing more.
5
+ * @param {any} body - Anthropic Messages or Converse request body.
6
+ * @param {any} [context] - `{ protocol }`, the protocol the request goes over.
7
+ * @returns {any} Normalized body.
8
+ */
9
+ export function request(body: any, context?: any): any;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Authenticate a call: a Bedrock API key (the upstream's `apiKey` or `AWS_BEARER_TOKEN_BEDROCK`) is sent as a bearer token, and otherwise the
3
+ * call is signed with SigV4 from the upstream's access keys or the `AWS_*` environment variables (see `lib/bedrock`). The signature covers the
4
+ * exact JSON text of the body, which is what the transport sends.
5
+ * @param {any} context - `{ endpoint, method, url, headers, body, stream }`.
6
+ * @returns {Record<string, string>} The headers to send.
7
+ * @throws {import("../../../lib/errors.mjs").TranslatorError} `missing_credentials` or `missing_region` (500).
8
+ */
9
+ export function sign({ endpoint, method, url, headers, body, stream }: any): Record<string, string>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Describe the generic OpenAI-compatible driver (matches last, after every specific driver).
3
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, fields: string[], paths: Record<string,string>}} Driver facts.
3
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], fields: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
6
6
  name: string;
@@ -8,6 +8,7 @@ export function info(): {
8
8
  order: number;
9
9
  auth: string;
10
10
  strict: boolean;
11
+ protocols: string[];
11
12
  fields: string[];
12
13
  paths: Record<string, string>;
13
14
  };
@@ -18,11 +18,12 @@
18
18
  */
19
19
  /**
20
20
  * Describe the DeepSeek driver.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, hosts: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hosts: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
25
25
  protocol: string;
26
+ protocols: string[];
26
27
  order: number;
27
28
  auth: string;
28
29
  strict: boolean;
@@ -1,10 +1,11 @@
1
1
  /**
2
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.
3
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
6
6
  name: string;
7
7
  protocol: string;
8
+ protocols: string[];
8
9
  order: number;
9
10
  auth: string;
10
11
  strict: boolean;
@@ -1,10 +1,11 @@
1
1
  /**
2
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.
3
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
6
6
  name: string;
7
7
  protocol: string;
8
+ protocols: string[];
8
9
  order: number;
9
10
  auth: string;
10
11
  strict: boolean;
@@ -1,10 +1,11 @@
1
1
  /**
2
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.
3
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
6
6
  name: string;
7
7
  protocol: string;
8
+ protocols: string[];
8
9
  order: number;
9
10
  auth: string;
10
11
  strict: boolean;
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /**
20
20
  * Describe the llama.cpp driver.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
@@ -26,6 +26,7 @@ export function info(): {
26
26
  order: number;
27
27
  auth: string;
28
28
  strict: boolean;
29
+ protocols: string[];
29
30
  probes: string[];
30
31
  fields: string[];
31
32
  paths: Record<string, string>;
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /**
20
20
  * Describe the LM Studio driver. It is found through `GET /api/v0/models`, LM Studio's own REST listing.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], probes: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
@@ -26,6 +26,7 @@ export function info(): {
26
26
  order: number;
27
27
  auth: string;
28
28
  strict: boolean;
29
+ protocols: string[];
29
30
  probes: string[];
30
31
  paths: Record<string, string>;
31
32
  };
@@ -19,7 +19,7 @@
19
19
  /**
20
20
  * Describe the LocalAI driver. It is found through `GET /version` (`{ version: "v3.1.0 (<commit>)" }`) or LocalAI's discovery document at
21
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.
22
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
23
23
  */
24
24
  export function info(): {
25
25
  name: string;
@@ -27,6 +27,7 @@ export function info(): {
27
27
  order: number;
28
28
  auth: string;
29
29
  strict: boolean;
30
+ protocols: string[];
30
31
  probes: string[];
31
32
  fields: string[];
32
33
  paths: Record<string, string>;
@@ -18,11 +18,12 @@
18
18
  */
19
19
  /**
20
20
  * Describe the Mistral driver. Mistral accepts only 9-character alphanumeric tool-call ids, so the translator rewrites the client's ids.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, hosts: string[], toolCallIds: {alphabet: string, min: number, max: number}, paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hosts: string[], toolCallIds: {alphabet: string, min: number, max: number}, paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
25
25
  protocol: string;
26
+ protocols: string[];
26
27
  order: number;
27
28
  auth: string;
28
29
  strict: boolean;
@@ -19,7 +19,7 @@
19
19
  /**
20
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
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
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], probes: string[], paths: Record<string,string>, native: {protocol: string, paths: Record<string,string>}}} Driver facts.
23
23
  */
24
24
  export function info(): {
25
25
  name: string;
@@ -27,6 +27,7 @@ export function info(): {
27
27
  order: number;
28
28
  auth: string;
29
29
  strict: boolean;
30
+ protocols: string[];
30
31
  probes: string[];
31
32
  paths: Record<string, string>;
32
33
  native: {
@@ -2,7 +2,7 @@
2
2
  * Remove `tool_choice`, `n` and `logit_bias` (recorded in `state.dropped`; with `tool_choice: "none"` the tools are removed too, so a forbidden tool call cannot happen), replace images given by URL with a note, and warn once per
3
3
  * upstream when the prompt is estimated to exceed `contextWindow` (Ollama truncates silently).
4
4
  * @param {any} body - Chat Completions request body.
5
- * @param {any} [ctx] - `{ endpoint, settings, state, warn }`.
5
+ * @param {any} [ctx] - `{ endpoint, settings, state, warn, protocol }` (`protocol` is the one the request goes over).
6
6
  * @returns {any} Normalized body.
7
7
  */
8
8
  export function request(body: any, ctx?: any): any;
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /**
20
20
  * Describe the OpenAI driver.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, hosts: string[], fields: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], hosts: string[], fields: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
@@ -26,6 +26,7 @@ export function info(): {
26
26
  order: number;
27
27
  auth: string;
28
28
  strict: boolean;
29
+ protocols: string[];
29
30
  hosts: string[];
30
31
  fields: string[];
31
32
  paths: Record<string, string>;
@@ -18,11 +18,12 @@
18
18
  */
19
19
  /**
20
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, hosts: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hosts: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
25
25
  protocol: string;
26
+ protocols: string[];
26
27
  order: number;
27
28
  auth: string;
28
29
  strict: boolean;
@@ -18,7 +18,7 @@
18
18
  */
19
19
  /**
20
20
  * Describe the SGLang driver.
21
- * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
21
+ * @returns {{name: string, protocol: string, order: number, auth: string, strict: boolean, protocols: string[], probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
22
22
  */
23
23
  export function info(): {
24
24
  name: string;
@@ -26,6 +26,7 @@ export function info(): {
26
26
  order: number;
27
27
  auth: string;
28
28
  strict: boolean;
29
+ protocols: string[];
29
30
  probes: string[];
30
31
  fields: string[];
31
32
  paths: Record<string, string>;
@@ -19,11 +19,12 @@
19
19
  /**
20
20
  * Describe the TGI driver. It is found through `GET /info`, TGI's router description. `grammar` is allowed through the OpenAI front's
21
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.
22
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, probes: string[], fields: string[], paths: Record<string,string>}} Driver facts.
23
23
  */
24
24
  export function info(): {
25
25
  name: string;
26
26
  protocol: string;
27
+ protocols: string[];
27
28
  order: number;
28
29
  auth: string;
29
30
  strict: boolean;
@@ -1,10 +1,11 @@
1
1
  /**
2
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.
3
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, fields?: string[], paths: Record<string,string>}} Driver facts.
4
4
  */
5
5
  export function info(): {
6
6
  name: string;
7
7
  protocol: string;
8
+ protocols: string[];
8
9
  order: number;
9
10
  auth: string;
10
11
  strict: boolean;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Add the Google access token as the bearer token and drop the headers Vertex AI does not take (`x-api-key`, `anthropic-version`; a client's
3
+ * `anthropic-beta` is kept). The token comes from `lib/google-auth.mjs`.
4
+ * @param {any} context - `{ endpoint, headers, transport, timeout }`.
5
+ * @returns {Promise<Record<string,string>>} Headers to send.
6
+ */
7
+ export function auth({ endpoint, headers, transport, timeout }: any): Promise<Record<string, string>>;
@@ -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 host is not a Vertex AI host.
5
+ */
6
+ export function detect({ endpoint }: any): {
7
+ host: string;
8
+ } | null;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Normalize Google's error envelope (`{ error: { code, message, status } }`, sometimes inside a one-element array) and Claude's own
3
+ * (`{ type: "error", error: { type, message } }`, which Vertex AI passes through) to the nested shape. Google's `status` (`NOT_FOUND`) becomes the code.
4
+ * @param {number} status - HTTP status.
5
+ * @param {*} body - Parsed upstream error body.
6
+ * @returns {{error: {message: string, type: string | undefined, param: *, code: *}}} Nested error body.
7
+ */
8
+ export function error(status: number, body: any): {
9
+ error: {
10
+ message: string;
11
+ type: string | undefined;
12
+ param: any;
13
+ code: any;
14
+ };
15
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Describe the Vertex AI driver. The paths come from the `path` leaf, because they hold the project, the region and the model; the key (a Google
3
+ * access token) is added as a bearer token by the `auth` leaf. Vertex AI takes no `anthropic-version` header (the version is in the body).
4
+ * @returns {{name: string, protocol: string, protocols: string[], order: number, auth: string, strict: boolean, hosts: string[], hostSuffixes: string[], paths: Record<string,string>}} Driver facts.
5
+ */
6
+ export function info(): {
7
+ name: string;
8
+ protocol: string;
9
+ protocols: string[];
10
+ order: number;
11
+ auth: string;
12
+ strict: boolean;
13
+ hosts: string[];
14
+ hostSuffixes: string[];
15
+ paths: Record<string, string>;
16
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Build the `rawPredict` path (`streamRawPredict` when `stream` is true) from the upstream's project and region and the request's model.
3
+ * @param {"messages" | "count"} kind - Which call.
4
+ * @param {any} context - `{ endpoint, model, stream }`.
5
+ * @returns {string} Path starting with `/v1/projects/`.
6
+ */
7
+ export function path(kind: "messages" | "count", { endpoint, model, stream }: any): string;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Add `anthropic_version` and take the model out of the body: Vertex AI names the model in the URL.
3
+ * @param {any} request - Messages request body.
4
+ * @returns {any} Vertex AI body.
5
+ */
6
+ export function request(request: any): any;
@@ -0,0 +1,23 @@
1
+ /**
2
+ *
3
+ * @Project: @cldmv/llm-translator
4
+ * @Filename: /src/api/driver/vertex/settings.mjs
5
+ * @Date: 2026-11-19T09:00:00-08:00 (1795107600)
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-19T09:00:00-08:00 (1795107600)
11
+ * -----
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
14
+ */
15
+ /**
16
+ * @fileoverview Vertex AI driver: translator settings.
17
+ * @module @cldmv/llm-translator/driver/vertex
18
+ */
19
+ /**
20
+ * Claude on Vertex AI speaks the Messages API, so the converters use the library defaults.
21
+ * @returns {any} Partial settings (empty).
22
+ */
23
+ export function settings(): any;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Count tokens with `POST .../publishers/anthropic/models/count-tokens:rawPredict`, which takes the model in the body. Any failure (a missing
3
+ * project or credentials, a 404 from a region or project without the method, a network error) gives null, so the caller uses the estimate.
4
+ * @param {any} context - `{ endpoint, request, transport, signal, timeout }`.
5
+ * @returns {Promise<number | null>} Token count, or null when Vertex AI did not answer.
6
+ */
7
+ export function count({ endpoint, request, transport, signal, timeout }: any): Promise<number | null>;