fern/03-reference/baml/client-llm.mdx
Clients are used to configure how LLMs are called, like so:
function MakeHaiku(topic: string) -> string {
client "openai/gpt-4o"
prompt #"
Write a haiku about {{ topic }}.
"#
}
<provider>/<model> shorthand for the Named Client version of MyClient:
client<llm> MyClient {
provider "openai"
options {
model "gpt-5"
// api_key defaults to env.OPENAI_API_KEY
}
}
function MakeHaiku(topic: string) -> string {
client MyClient
prompt #"
Write a haiku about {{ topic }}.
"#
}
Consult the provider documentation for a list of supported providers and models, and the default options.
If you want to override options like api_key to use a different environment
variable, or you want to point base_url to a different endpoint, you should use
the latter form.
This can come in handy if you're trying to, say, send 10% of your requests to a different model. </Tip>