ByokFactory

fun interface ByokFactory

A self-contained spec that can validate an API key and return a ready LlmService.

Each instance encapsulates the provider endpoint, credentials, and the model to use for the validation probe. Implementations throw InvalidApiKeyException on failure so callers never need to unwrap provider-specific error types.

Implementations are provided by:

  • com.embabel.agent.config.models.anthropic.AnthropicModelFactory — Anthropic

  • com.embabel.agent.openai.OpenAiCompatibleModelFactory.ByokSpec — OpenAI-compatible providers (OpenAI, DeepSeek, Mistral, Gemini, and custom providers)

Pass one or more instances to detectProvider to race them concurrently.

Functions

Link copied to clipboard
abstract fun buildValidated(): LlmService<*>

Validates the configured API key with a single probe call and returns a production LlmService on success.