docs/cli/generation-settings.md
This guide details the Model Configuration system within Gemini CLI. Designed for researchers, AI quality engineers, and advanced users, this system provides a rigorous framework for managing generative model hyperparameters and behaviors.
<!-- prettier-ignore -->[!WARNING] This is a power-user feature. Configuration values are passed directly to the model provider with minimal validation. Incorrect settings (for example, incompatible parameter combinations) may result in runtime errors from the API.
The Model Configuration system (ModelConfigService) enables deterministic
control over model generation. It decouples the requested model identifier (for
example, a CLI flag or agent request) from the underlying API configuration.
This allows for:
temperature, topP,
thinkingBudget, and other SDK-level parameters.The system operates on two core primitives: Aliases and Overrides.
These settings are located under the modelConfigs key in your configuration
file.
customAliases)Aliases are named, reusable configuration presets. Users should define their own
aliases (or override system defaults) in the customAliases map.
extends another alias (including system
defaults like chat-base), inheriting its modelConfig. Child aliases can
overwrite or augment inherited settings.model
if it serves purely as a base for other aliases.Example Hierarchy:
"modelConfigs": {
"customAliases": {
"base": {
"modelConfig": {
"generateContentConfig": { "temperature": 0.0 }
}
},
"chat-base": {
"extends": "base",
"modelConfig": {
"generateContentConfig": { "temperature": 0.7 }
}
}
}
}
overrides)Overrides are conditional rules that inject configuration based on the runtime context. They are evaluated dynamically for each model request.
match properties.
model: Matches the requested model name or alias.overrideScope: Matches the distinct scope of the request (typically the
agent name, for example, codebaseInvestigator).Example Override:
"modelConfigs": {
"overrides": [
{
"match": {
"overrideScope": "codebaseInvestigator"
},
"modelConfig": {
"generateContentConfig": { "temperature": 0.1 }
}
}
]
}
The ModelConfigService resolves the final configuration through a two-step
process:
The requested model string is looked up in the merged map of system aliases
and user customAliases.
extends chain.ResolvedModelConfig.The system evaluates the overrides list against the request context (model
and overrideScope).
match object).
model + overrideScope) override broad
matches (for example, model only).overrides array is preserved (last one wins).The configuration follows the ModelConfigServiceConfig interface.
ModelConfig ObjectDefines the actual parameters for the model.
| Property | Type | Description |
|---|---|---|
model | string | The identifier of the model to be called (for example, gemini-2.5-pro). |
generateContentConfig | object | The configuration object passed to the @google/genai SDK. |
GenerateContentConfig (Common Parameters)Directly maps to the SDK's GenerateContentConfig. Common parameters include:
temperature: (number) Controls output randomness. Lower values (0.0)
are deterministic; higher values (>0.7) are creative.topP: (number) Nucleus sampling probability.maxOutputTokens: (number) Limit on generated response length.thinkingConfig: (object) Configuration for models with reasoning
capabilities (for example, thinkingBudget, includeThoughts).Create an alias for tasks requiring high precision, extending the standard chat configuration but enforcing zero temperature.
"modelConfigs": {
"customAliases": {
"precise-mode": {
"extends": "chat-base",
"modelConfig": {
"generateContentConfig": {
"temperature": 0.0,
"topP": 1.0
}
}
}
}
}
Enforce extended thinking budgets for a specific agent without altering the
global default, for example for the codebaseInvestigator.
"modelConfigs": {
"overrides": [
{
"match": {
"overrideScope": "codebaseInvestigator"
},
"modelConfig": {
"generateContentConfig": {
"thinkingConfig": { "thinkingBudget": 4096 }
}
}
}
]
}
Route traffic for a specific alias to a preview model for A/B testing, without changing client code.
"modelConfigs": {
"overrides": [
{
"match": {
"model": "gemini-2.5-pro"
},
"modelConfig": {
"model": "gemini-2.5-pro-experimental-001"
}
}
]
}