Skip to content

rulvar API reference


rulvar API reference / @rulvar/openai

@rulvar/openai

Classes

ClassDescription
OpenAiIdMapBijective canonical-to-wire (call_*) id map.

Interfaces

InterfaceDescription
OpenAiAdapterOptions-
OpenAiClientLikeThe client sub-surface the adapter consumes; injectable for tests.
OpenAiCompatibleConfig-
OpenAiModelInfo-

Type Aliases

Type AliasDescription
ResponsesStreamEventRaw Responses SSE events, structurally typed.

Variables

VariableDescription
CONSERVATIVE_COMPATIBLE_CAPSGateways cannot be introspected reliably: when caps are not supplied the factory assumes the most conservative capability set. Callers SHOULD supply caps for anything beyond it; the window and output floors here are deliberately small so an unprobed endpoint is never overcommitted. Absent pricing is legitimate for local models: they surface as unpriced in CostReport.
OPENAI_MODELSStatic seed table of the current model set.

Functions

FunctionDescription
buildChatCompletionsParamsThe Chat Completions degraded path: delta-patched chunk assembly instead of typed SSE, nested function tools with explicit strict where supported, response_format instead of text.format, no reasoning item replay. Selected by caps (api: 'chat'), visible in events, never silent.
buildResponsesParamsBuilds Responses API params. Manual item replay ONLY: store: false plus include reasoning.encrypted_content; previous_response_id and the Conversations API place state server-side, break replay identity, and are REJECTED as a typed ConfigError. Role 'system' messages project into top-level instructions on every request.
mapChatCompletionsStreamDelta-patched chunk assembly for the degraded path.
mapOpenAiEffortCanonical-to-wire effort: low through xhigh pass through; canonical max downmaps to xhigh (documented lossy; recorded in providerMetadata); provider 'none' is reachable only via providerOptions.openai.reasoningEffort.
mapResponsesStreamMaps the typed Responses SSE stream to ChatEvents. Canonical parts come from the typed output array, never the output_text aggregate. Raw output items ride finish.providerMetadata.openai.outputItems so the runtime can retain reasoning items as provider-raw parts.
normalizeOpenAiUsageNormalizes Responses usage: input_tokens already includes cached reads.
openai@rulvar/openai: the first-class OpenAI Responses API adapter with the Chat Completions degraded path, plus the openaiCompatible factory for Ollama, vLLM, and gateways.
openaiCompatibleCreates a Chat Completions dialect adapter for a compatible endpoint.
openAiErrorToWireProjects SDK/API errors into the retryable WireError vocabulary.
openAiModelInfoUnknown OpenAI models are assumed current-generation Responses models.