OpenAiConfig.ts
OpenAiConfig.ts overview
Section titled “OpenAiConfig.ts overview”The OpenAiConfig module lets a workflow temporarily customize the HTTP
client used by OpenAI-compatible request helpers. Model, embedding, and
tool-calling code can use this scoped configuration to add middleware,
instrumentation, or routing without rebuilding the client layer.
Since v4.0.0
Exports Grouped by Category
Section titled “Exports Grouped by Category”configuration
Section titled “configuration”withClientTransform
Section titled “withClientTransform”Provides an HTTP client transform for the supplied effect.
When to use
Use to add provider-specific OpenAI-compatible HTTP behavior, such as headers, retries, instrumentation, or proxy routing.
Details
OpenAI-compatible provider services read the transform from the
OpenAiConfig context.
Signature
declare const withClientTransform: { (transform: (client: HttpClient) => HttpClient): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> <A, E, R>(self: Effect.Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect.Effect<A, E, R>}Since v4.0.0
services
Section titled “services”OpenAiConfig (class)
Section titled “OpenAiConfig (class)”Context service for OpenAI-compatible client configuration in the current Effect scope.
When to use
Use as the context service for scoped OpenAI-compatible client configuration and HTTP client transforms.
See
withClientTransformfor scoping an HTTP client transformation
Signature
declare class OpenAiConfigSince v4.0.0
OpenAiConfig (namespace)
Section titled “OpenAiConfig (namespace)”Types associated with the OpenAiConfig context service.
Since v4.0.0
Service (interface)
Section titled “Service (interface)”Configuration consumed by OpenAI-compatible clients when they build or resolve the underlying HTTP client.
Signature
export interface Service { readonly transformClient?: ((client: HttpClient) => HttpClient) | undefined}Since v4.0.0