Skip to content

OpenRouterClient

9 exports Added in v1.0.0 Source

Constructors

make

Added in v1.0.0 Source

Signature

declare const make: (options: {
  readonly apiKey?: Redacted.Redacted;
  readonly apiUrl?: string;
  readonly referrer?: string;
  readonly title?: string;
  readonly transformClient?: (client: HttpClient.HttpClient) => HttpClient.HttpClient;
}) => Effect.Effect<Service, never, HttpClient.HttpClient>;

Context

Signature

declare class OpenRouterClient extends any {
  constructor();
}

Layers

layer

Added in v1.0.0 Source

Signature

declare function layer(options: {
  readonly apiKey?: Redacted<string>;
  readonly apiUrl?: string;
  readonly referrer?: string;
  readonly title?: string;
  readonly transformClient?: (client: HttpClient) => HttpClient;
}): Layer<OpenRouterClient, never, HttpClient>;

layerConfig

Added in v1.0.0 Source

Signature

declare function layerConfig(options: {
  readonly apiKey?: Config<Redacted<string>>;
  readonly apiUrl?: Config<string>;
  readonly referrer?: Config<string>;
  readonly title?: Config<string>;
  readonly transformClient?: (client: HttpClient) => HttpClient;
}): Layer<OpenRouterClient, ConfigError, HttpClient>;

Models

Service interface

Added in v1.0.0 Source

Signature

interface Service {
  readonly client: Client;
  readonly createChatCompletion: (options: { [key: string]: any }) => Effect<ChatResponse, AiError>;
  readonly createChatCompletionStream: (
    options: Omit<typeof Generated.ChatGenerationParams.Encoded, "stream">,
  ) => Stream<ChatStreamingResponseChunk, AiError>;
}

Schemas

Signature

declare class ChatStreamingChoice extends {
  [key: string]: any;
} {
  [key: string]: any;
  constructor(...args: [props?: {
    [key: string]: any;
  }, options?: MakeOptions]);
}

Signature

declare class ChatStreamingMessageChunk extends {
  [key: string]: any;
} {
  [key: string]: any;
  constructor(...args: [props?: {
    [key: string]: any;
  }, options?: MakeOptions]);
}

Signature

declare class ChatStreamingMessageToolCall extends {
  [key: string]: any;
} {
  [key: string]: any;
  constructor(...args: [props?: {
    [key: string]: any;
  }, options?: MakeOptions]);
}

Signature

declare class ChatStreamingResponseChunk extends {
  [key: string]: any;
} {
  [key: string]: any;
  constructor(...args: [props?: {
    [key: string]: any;
  }, options?: MakeOptions]);
}