fern/03-reference/baml/clients/providers/google-ai.mdx
The google-ai provider supports the https://generativelanguage.googleapis.com/v1beta/models/{model_id}/generateContent and https://generativelanguage.googleapis.com/v1beta/models/{model_id}/streamGenerateContent endpoints.
Example:
client<llm> MyClient {
provider google-ai
options {
model "gemini-3.5-flash"
}
}
optionsThese unique parameters (aka options) modify the API request sent to the provider.
You can use this to modify the headers and base_url for example.
<ParamField path="api_key" type="string"
Will be passed as the x-goog-api-key header. Default: env.GOOGLE_API_KEY
x-goog-api-key: $api_key
</ParamField>
<ParamField path="model" type="string" required
The model to use.
We don't have any checks for this field, you can pass any string you wish.
| Model | Use Case | Context | Key Features |
|---|---|---|---|
| gemini-3.1-pro-preview | Complex tasks, coding, STEM | 1M | Adaptive thinking, multimodal |
| gemini-3.5-flash | Production apps, balanced performance | 1M | Best price/performance |
| gemini-3.1-flash-lite | High-volume, cost-sensitive | 1M | Lowest cost, fastest |
See the Google Model Docs for the latest models. </ParamField>
<Tip> Some parameters, like temperature, for Gemini Models are specified in the `generationConfig` object. [See Docs](https://ai.google.dev/api/generate-content) </Tip> <ParamField path="headers" type="object"> Additional headers to send with the request.Example:
client<llm> MyClient {
provider google-ai
options {
model "gemini-3.5-flash"
headers {
"X-My-Header" "my-value"
}
generationConfig {
temperature 0.5
}
}
}
These are other options that are passed through to the provider, without modification by BAML. For example if the request has a temperature field, you can define it in the client here so every call has that set.
Consult the specific provider's documentation for more information. <ParamField path="contents" type="DO NOT USE"
BAML will auto construct this field for you from the prompt </ParamField>
For all other options, see the official Google Gemini API documentation.