Constructs an LLMClient for the provider config names, recording call statistics to metrics.
Constructs an LLMClient for the provider config names, recording call statistics to metrics.
A config whose provider is not registered yields a org.llm4s.error.ConfigurationError listing the providers that are; Left is also returned if the underlying client constructor fails (for example, if the HTTP client library throws during initialisation).
Value parameters
config
Provider configuration; its providerId selects the client. For OpenRouter, supply an OpenAIConfig whose baseUrl contains "openrouter.ai".
Constructs an LLMClient without recording call statistics.
Constructs an LLMClient without recording call statistics.
Suitable for applications that do not integrate with a metrics backend. Switch to the two-argument overload when per-call latency or token-usage data is needed (e.g. for Prometheus or Micrometer).
Value parameters
config
Provider configuration; its providerId selects the client.
Constructs an LLMClient, verifying at runtime that provider and config are consistent with each other.
Constructs an LLMClient, verifying at runtime that provider and config are consistent with each other.
Returns Left in two situations: the provider/config pair is mismatched (yields a org.llm4s.error.ConfigurationError), or the underlying client constructor fails during initialisation. Use this overload when the provider is resolved dynamically from user input or external config and you want an explicit error on mismatch rather than silent wrong routing.