OpenRouterLLMClient

class OpenRouterLLMClient(apiKey: String, settings: OpenRouterClientSettings = OpenRouterClientSettings(), baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System) : AbstractOpenAILLMClient<OpenRouterChatCompletionResponse, OpenRouterChatCompletionStreamResponse> (source)

Implementation of LLMClient for OpenRouter API. OpenRouter is an API that routes requests to multiple LLM providers.

Parameters

apiKey

The API key for the OpenRouter API

settings

The base URL and timeouts for the OpenRouter API, defaults to "https://openrouter.ai" and 900s

clock

Clock instance used for tracking response metadata timestamps.

Constructors

Link copied to clipboard
constructor(apiKey: String, settings: OpenRouterClientSettings = OpenRouterClientSettings(), baseClient: HttpClient = HttpClient(), clock: Clock = Clock.System)

Functions

Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
open suspend override fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
open override fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow<StreamFrame>
Link copied to clipboard
open suspend override fun moderate(prompt: Prompt, model: LLModel): ModerationResult