/** * @since 1.0.0 */ import * as AiError from "@effect/ai/AiError"; import * as HttpClient from "@effect/platform/HttpClient"; import * as Config from "effect/Config"; import type { ConfigError } from "effect/ConfigError"; import * as Context from "effect/Context"; import * as Effect from "effect/Effect"; import * as Layer from "effect/Layer"; import type * as Redacted from "effect/Redacted"; import * as Schema from "effect/Schema"; import * as Stream from "effect/Stream"; import * as Generated from "./Generated.js"; declare const OpenRouterClient_base: Context.TagClass; /** * @since 1.0.0 * @category Context */ export declare class OpenRouterClient extends OpenRouterClient_base { } /** * @since 1.0.0 * @category Models */ export interface Service { /** * The underlying HTTP client capable of communicating with the OpenRouter API. * * This client is pre-configured with authentication, base URL, and standard * headers required for OpenRouter API communication. It provides direct access * to the generated OpenRouter API client for operations not covered by the * higher-level methods. * * Use this when you need to: * - Access provider-specific API endpoints not available through the AI SDK * - Implement custom request/response handling * - Use OpenRouter API features not yet supported by the Effect AI abstractions * - Perform batch operations or non-streaming requests * * The client automatically handles authentication and follows OpenRouter's * API conventions for request formatting and error handling. */ readonly client: Generated.Client; readonly createChatCompletion: (options: typeof Generated.ChatGenerationParams.Encoded) => Effect.Effect; readonly createChatCompletionStream: (options: Omit) => Stream.Stream; } /** * @since 1.0.0 * @category Constructors */ export declare const make: (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; }) => Effect.Effect; /** * @since 1.0.0 * @category Layers */ export declare const layer: (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; }) => Layer.Layer; /** * @since 1.0.0 * @category Layers */ export declare const layerConfig: (options: { readonly apiKey?: Config.Config | undefined; readonly apiUrl?: Config.Config | undefined; /** * Optional URL of your site for rankings on `openrouter.ai`. */ readonly referrer?: Config.Config | undefined; /** * Optional title of your site for rankings on `openrouter.ai`. */ readonly title?: Config.Config | 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; }) => Layer.Layer; declare const ChatStreamingMessageToolCall_base: Schema.Class; type: Schema.optionalWith, { nullable: true; }>; function: Schema.Struct<{ name: Schema.optionalWith; arguments: Schema.optionalWith; }>; }, Schema.Struct.Encoded<{ index: typeof Schema.Number; id: Schema.optionalWith; type: Schema.optionalWith, { nullable: true; }>; function: Schema.Struct<{ name: Schema.optionalWith; arguments: Schema.optionalWith; }>; }>, never, { readonly function: { readonly name?: string | undefined; readonly arguments?: string | undefined; }; } & { readonly type?: "function" | undefined; } & { readonly id?: string | undefined; } & { readonly index: number; }, {}, {}>; /** * @since 1.0.0 * @category Schemas */ export declare class ChatStreamingMessageToolCall extends ChatStreamingMessageToolCall_base { } declare const ChatStreamingMessageChunk_base: Schema.Class, { nullable: true; }>; content: Schema.optionalWith; reasoning: Schema.optionalWith; reasoning_details: Schema.optionalWith, { nullable: true; }>; images: Schema.optionalWith, { nullable: true; }>; refusal: Schema.optionalWith; tool_calls: Schema.optionalWith, { nullable: true; }>; annotations: Schema.optionalWith, { nullable: true; }>; }, Schema.Struct.Encoded<{ role: Schema.optionalWith, { nullable: true; }>; content: Schema.optionalWith; reasoning: Schema.optionalWith; reasoning_details: Schema.optionalWith, { nullable: true; }>; images: Schema.optionalWith, { nullable: true; }>; refusal: Schema.optionalWith; tool_calls: Schema.optionalWith, { nullable: true; }>; annotations: Schema.optionalWith, { nullable: true; }>; }>, never, { readonly annotations?: readonly (Generated.FileAnnotationDetail | Generated.URLCitationAnnotationDetail)[] | undefined; } & { readonly reasoning?: string | undefined; } & { readonly content?: string | undefined; } & { readonly role?: "assistant" | undefined; } & { readonly refusal?: string | undefined; } & { readonly tool_calls?: readonly ChatStreamingMessageToolCall[] | undefined; } & { readonly reasoning_details?: readonly (Generated.ReasoningDetailSummary | Generated.ReasoningDetailEncrypted | Generated.ReasoningDetailText)[] | undefined; } & { readonly images?: readonly Generated.ChatMessageContentItemImage[] | undefined; }, {}, {}>; /** * @since 1.0.0 * @category Schemas */ export declare class ChatStreamingMessageChunk extends ChatStreamingMessageChunk_base { } declare const ChatStreamingChoice_base: Schema.Class; finish_reason: Schema.optionalWith; native_finish_reason: Schema.optionalWith; logprobs: Schema.optionalWith; }, Schema.Struct.Encoded<{ index: typeof Schema.Number; delta: Schema.optionalWith; finish_reason: Schema.optionalWith; native_finish_reason: Schema.optionalWith; logprobs: Schema.optionalWith; }>, never, { readonly index: number; } & { readonly logprobs?: Generated.ChatMessageTokenLogprobs | undefined; } & { readonly finish_reason?: "length" | "content_filter" | "error" | "stop" | "tool_calls" | undefined; } & { readonly native_finish_reason?: string | undefined; } & { readonly delta?: ChatStreamingMessageChunk | undefined; }, {}, {}>; /** * @since 1.0.0 * @category Schemas */ export declare class ChatStreamingChoice extends ChatStreamingChoice_base { } declare const ChatStreamingResponseChunk_base: Schema.Class; model: Schema.optionalWith, { nullable: true; }>; provider: Schema.optionalWith; created: typeof Schema.DateTimeUtcFromNumber; choices: Schema.Array$; error: Schema.optionalWith>; message: typeof Schema.String; param: Schema.optionalWith; type: Schema.optionalWith; }>, { nullable: true; }>; system_fingerprint: Schema.optionalWith; usage: Schema.optionalWith; }, Schema.Struct.Encoded<{ id: Schema.optionalWith; model: Schema.optionalWith, { nullable: true; }>; provider: Schema.optionalWith; created: typeof Schema.DateTimeUtcFromNumber; choices: Schema.Array$; error: Schema.optionalWith>; message: typeof Schema.String; param: Schema.optionalWith; type: Schema.optionalWith; }>, { nullable: true; }>; system_fingerprint: Schema.optionalWith; usage: Schema.optionalWith; }>, never, { readonly id?: string | undefined; } & { readonly model?: `${string}/${string}` | undefined; } & { readonly provider?: string | undefined; } & { readonly usage?: Generated.ChatGenerationTokenUsage | undefined; } & { readonly error?: { readonly type?: string | undefined; readonly message: string; readonly code: string | number | null; readonly param?: string | undefined; } | undefined; } & { readonly created: import("effect/DateTime").Utc; } & { readonly choices: readonly ChatStreamingChoice[]; } & { readonly system_fingerprint?: string | undefined; }, {}, {}>; /** * @since 1.0.0 * @category Schemas */ export declare class ChatStreamingResponseChunk extends ChatStreamingResponseChunk_base { } export {}; //# sourceMappingURL=OpenRouterClient.d.ts.map