MCPcopy Create free account
hub / github.com/Effect-TS/effect / layer

Function layer

packages/ai/openrouter/src/OpenRouterClient.ts:227–260  ·  view source on GitHub ↗
(options: {
  readonly apiKey?: Redacted.Redacted | undefined
  readonly apiUrl?: string | undefined
  /**
   * Optional URL of your site for rankings on `openrouter.ai`.
   */
  readonly referrer?: string | undefined
  /**
   * Optional title of your site for rankings on `openrouter.ai`.
   */
  readonly title?: string | undefined
  /**
   * A function to transform the underlying HTTP client before it's used to send
   * API requests.
   *
   * This transformation function receives the configured HTTP client and returns
   * a modified version. It's applied after all standard client configuration
   * (authentication, base URL, headers) but before any requests are made.
   *
   * Use this for:
   * - Adding custom middleware (logging, metrics, caching)
   * - Modifying request/response processing behavior
   * - Adding custom retry logic or error handling
   * - Integrating with monitoring or debugging tools
   * - Applying organization-specific HTTP client policies
   *
   * The transformation is applied once during client initialization and affects
   * all subsequent API requests made through this client instance.
   *
   * Leave absent or set to `undefined` if no custom HTTP client behavior is
   * needed.
   */
  readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
})

Source from the content-addressed store, hash-verified

225 * @category Layers
226 */
227export const layer = (options: {
228 readonly apiKey?: Redacted.Redacted | undefined
229 readonly apiUrl?: string | undefined
230 /**
231 * Optional URL of your site for rankings on `openrouter.ai`.
232 */
233 readonly referrer?: string | undefined
234 /**
235 * Optional title of your site for rankings on `openrouter.ai`.
236 */
237 readonly title?: string | undefined
238 /**
239 * A function to transform the underlying HTTP client before it's used to send
240 * API requests.
241 *
242 * This transformation function receives the configured HTTP client and returns
243 * a modified version. It's applied after all standard client configuration
244 * (authentication, base URL, headers) but before any requests are made.
245 *
246 * Use this for:
247 * - Adding custom middleware (logging, metrics, caching)
248 * - Modifying request/response processing behavior
249 * - Adding custom retry logic or error handling
250 * - Integrating with monitoring or debugging tools
251 * - Applying organization-specific HTTP client policies
252 *
253 * The transformation is applied once during client initialization and affects
254 * all subsequent API requests made through this client instance.
255 *
256 * Leave absent or set to `undefined` if no custom HTTP client behavior is
257 * needed.
258 */
259 readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
260}): Layer.Layer<OpenRouterClient, never, HttpClient.HttpClient> => Layer.effect(OpenRouterClient, make(options))
261
262/**
263 * @since 1.0.0

Callers

nothing calls this directly

Calls 1

makeFunction · 0.70

Tested by

no test coverage detected