| 225 | * @category Layers |
| 226 | */ |
| 227 | export 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 |