Added in 0.216.0
The client option provides a simple way to override which LLM client a function uses at runtime.
It’s a shorthand for creating a ClientRegistry and calling set_primary().
Use the client option when you want to:
.baml filesIf you provide both client and client_registry, the client option takes precedence:
The client value can be:
Shorthand provider/model syntax - Use provider/model format for quick access:
"openai/gpt-4o-mini" - OpenAI models"anthropic/claude-sonnet-4-20250514" - Anthropic models"openrouter/meta-llama/llama-3.1-70b-instruct" - OpenRouter models"google-ai/gemini-2.0-flash" - Google AI modelsClient defined in .baml files - Reference by name (e.g., "MyCustomClient")
If the client name is not found, you’ll get a runtime error when the function is called.
Use client for simple overrides. Use ClientRegistry when you need to add new clients or customize client options at runtime.