Provider request-transform helpers. Adapts messages and request options to a model's declared capabilities (filtering unsupported attachments, deriving temperature/reasoning variants, capping output tokens) before a request is sent.
Members
(static, constant) OUTPUT_TOKEN_MAX
Hard cap on output tokens (overridable via CLOSEDCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX).
(static, constant) ProviderTransform
Aggregated namespace of the provider-transform helpers.
Methods
(static) maxOutputTokens(model) → {number}
Compute the max output tokens for a request: the model's output limit clamped to OUTPUT_TOKEN_MAX (falling back to that cap when no limit is set).
| Name | Type | Description |
|---|---|---|
model | Object | The resolved model (its |
The capped max output token count.
- Type:
- number
(static) message(msgs, model, _options) → {Array}
Filter message file parts down to modalities the model can actually accept, dropping attachments whose MIME type maps to an unsupported (or unknown) modality.
| Name | Type | Description |
|---|---|---|
msgs | Array | The chat messages. |
model | Object | The resolved model (its |
_options | * | Unused; reserved for future per-request options. |
The messages with unsupported file parts removed.
- Type:
- Array
(static) options(input) → {Object}
Build the request options bag, spreading the caller's provider options and nesting them under the providerOptions namespace via providerOptions.
| Name | Type | Description |
|---|---|---|
input | Object |
|
The combined options object.
- Type:
- Object
(static) providerOptions(_model, options) → {Object}
Wrap provider options under the openaiCompatible namespace expected by the
| Name | Type | Description |
|---|---|---|
_model | Object | The resolved model (unused). |
options | Object | The provider options to namespace. |
{openaiCompatible: options}.
- Type:
- Object
(static) schema(_model, schema) → {Object}
Transform an output JSON schema for a model (currently a pass-through).
| Name | Type | Description |
|---|---|---|
_model | Object | The resolved model (unused). |
schema | Object | The schema to transform. |
The schema, unchanged.
- Type:
- Object
(static) smallOptions(model) → {Object}
Build the default options for the small/auxiliary model (empty provider options).
| Name | Type | Description |
|---|---|---|
model | Object | The resolved model. |
The options object from options.
- Type:
- Object
(static) temperature(model) → {number}
Resolve the temperature to send for a model: 0 when supported, undefined otherwise.
| Name | Type | Description |
|---|---|---|
model | Object | The resolved model (its |
0 if temperature is supported; otherwise undefined.
- Type:
- number
(static) topK(_model) → {*}
Resolve the top-k value to send for a model (currently always unset).
| Name | Type | Description |
|---|---|---|
_model | Object | The resolved model (unused). |
undefined.
- Type:
- *
(static) topP(_model) → {*}
Resolve the top-p value to send for a model (currently always unset).
| Name | Type | Description |
|---|---|---|
_model | Object | The resolved model (unused). |
undefined.
- Type:
- *
(static) variants(model) → {Object}
Build the set of reasoning-effort variants ("low"/"medium"/"high") for a model that supports reasoning; returns an empty object when reasoning is unsupported.
| Name | Type | Description |
|---|---|---|
model | Object | The resolved model (its |
A map of variant name to options, or {}.
- Type:
- Object
(inner) mimeToModality(mime) → {string}
Map a MIME type to the modality category used by model capability checks.
| Name | Type | Description |
|---|---|---|
mime | string | The media type (e.g. "image/png", "application/pdf"). |
"image" | "audio" | "video" | "pdf", or undefined if unrecognized.
- Type:
- string