OpenAiConfig
The OpenAiConfig module lets a workflow temporarily customize the HTTP client used by @effect/ai-openai request helpers. OpenAI client, language model, and embedding code read this scoped transform when they execute provider calls.
Configuration
withClientTransform
Added in v4.0.0
Source
Signature
declare const withClientTransform: {
(
transform: (client: HttpClient) => HttpClient,
): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
<A, E, R>(self: Effect<A, E, R>, transform: (client: HttpClient) => HttpClient): Effect<A, E, R>;
};Other
OpenAiConfig
Added in v4.0.0
Source
Types used by the OpenAiConfig context service.
Services
OpenAiConfig
Added in v4.0.0
Source
Context service for scoped OpenAI configuration used by provider operations.
When to use
Use to provide scoped OpenAI client configuration, such as an HTTP client transform, to OpenAI provider operations without passing it through each call.
See
withClientTransformfor scoping an HTTP client transformation
Signature
declare class OpenAiConfig extends Shape<"@effect/ai-openai/OpenAiConfig", Service, this> {
constructor(_: never);
static readonly getOrUndefined: Effect<Service | undefined>;
}
Provides a scoped transform for the OpenAI HTTP client used by provider operations.
When to use
Use when you need temporary OpenAI HTTP client customization for a single effect or workflow without rebuilding the client layer.
Details
Supports both data-first and data-last forms. The transform is stored in the scoped
OpenAiConfigservice and read by OpenAI provider operations while running the supplied effect.Gotchas
If a transform is already present in the scoped config, this helper replaces it. Compose transforms manually when both should apply.