Skip to content

OpenAiConfig.ts

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



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>
}

Source

Since v4.0.0

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

  • withClientTransform for scoping an HTTP client transformation

Signature

declare class OpenAiConfig

Source

Since v4.0.0

Types associated with the OpenAiConfig context service.

Source

Since v4.0.0

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
}

Source

Since v4.0.0