OpenAIBackendAdapter
Defined in: backend/src/providers/openai.ts:159
Backend adapter for OpenAI Chat Completions API.
Extended by
Section titled “Extended by”Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new OpenAIBackendAdapter(
config,metadataOverride?):OpenAIBackendAdapter
Defined in: backend/src/providers/openai.ts:171
Create a new OpenAI backend adapter.
Parameters
Section titled “Parameters”config
Section titled “config”Backend adapter configuration
metadataOverride?
Section titled “metadataOverride?”Partial<AdapterMetadata>
Optional metadata to override defaults (used by subclasses)
Returns
Section titled “Returns”OpenAIBackendAdapter
Properties
Section titled “Properties”baseURL
Section titled “baseURL”
protectedreadonlybaseURL:string
Defined in: backend/src/providers/openai.ts:162
config
Section titled “config”
protectedreadonlyconfig:BackendAdapterConfig
Defined in: backend/src/providers/openai.ts:161
metadata
Section titled “metadata”
readonlymetadata:AdapterMetadata
Defined in: backend/src/providers/openai.ts:160
Adapter metadata for identification and capabilities.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”estimateCost()
Section titled “estimateCost()”estimateCost(
request):Promise<number|null>
Defined in: backend/src/providers/openai.ts:486
Estimate cost for a request (rough heuristic).
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Promise<number | null>
Implementation of
Section titled “Implementation of”execute()
Section titled “execute()”execute(
request,signal?):Promise<IRChatResponse>
Defined in: backend/src/providers/openai.ts:221
Execute non-streaming chat completion request.
Parameters
Section titled “Parameters”request
Section titled “request”signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Promise<IRChatResponse>
Implementation of
Section titled “Implementation of”executeStream()
Section titled “executeStream()”executeStream(
request,signal?):IRChatStream
Defined in: backend/src/providers/openai.ts:260
Execute streaming chat completion request.
Parameters
Section titled “Parameters”request
Section titled “request”signal?
Section titled “signal?”AbortSignal
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”fromIR()
Section titled “fromIR()”fromIR(
request):OpenAIRequest
Defined in: backend/src/providers/openai.ts:605
Convert IR request to OpenAI format.
Public method for testing and debugging - see what will be sent to OpenAI.
Parameters
Section titled “Parameters”request
Section titled “request”Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”healthCheck()
Section titled “healthCheck()”healthCheck():
Promise<boolean>
Defined in: backend/src/providers/openai.ts:470
Health check to verify OpenAI API is accessible.
Returns
Section titled “Returns”Promise<boolean>
Implementation of
Section titled “Implementation of”invalidateModelCache()
Section titled “invalidateModelCache()”invalidateModelCache():
OpenAIBackendAdapter
Defined in: backend/src/providers/openai.ts:591
Invalidate the cached model list.
Forces the next listModels() call to fetch fresh data from the API (unless static models are configured).
Returns
Section titled “Returns”OpenAIBackendAdapter
This adapter for method chaining
listModels()
Section titled “listModels()”listModels(
options?):Promise<ListModelsResult>
Defined in: backend/src/providers/openai.ts:501
List available models from OpenAI.
This method supports three sources:
- Static config (config.models) - highest priority
- Cache (if enabled and not expired)
- Remote API (/v1/models endpoint)
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<ListModelsResult>
Implementation of
Section titled “Implementation of”toIR()
Section titled “toIR()”toIR(
response,originalRequest,latencyMs):IRChatResponse
Defined in: backend/src/providers/openai.ts:652
Convert OpenAI response to IR format.
Public method for testing and debugging - parse OpenAI responses manually.
Parameters
Section titled “Parameters”response
Section titled “response”originalRequest
Section titled “originalRequest”latencyMs
Section titled “latencyMs”number