Skip to content

OpenAiConfig

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.

3 exports Added in v4.0.0 Source

Configuration

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<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 associated with the OpenAiConfig context service.

Services

OpenAiConfig

Added in v4.0.0 Source

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

Signature

declare class OpenAiConfig extends Shape<"@effect/ai-openai-compat/OpenAiConfig", Service, this> {
  constructor(_: never);
  static readonly getOrUndefined: Effect<Service | undefined>;
}