Method Signature
Description
Makes an API request to list the available models. Returns a paginated response with model information. By default, returns all available base models. Can be configured to list tuned models instead.Parameters
ListModelsConfig
Configuration for listing models.
Response
Returns aPager[Model] object that supports iteration and pagination.
Pager Properties
list[Model]
Current page of models
str
Token for the next page (if more results exist)
Model Properties
str
The model resource name.Examples:
- Base model:
'publishers/google/models/gemini-2.0-flash' - Tuned model:
'projects/my-project/locations/us-central1/models/1234567890'
str
Human-readable model name
str
Model description
str
Model version
int
Maximum input tokens supported
int
Maximum output tokens supported
list[str]
Supported methods (e.g.,
['generateContent', 'countTokens'])float
Default temperature
float
Maximum allowed temperature
float
Default top-p value
int
Default top-k value
Code Examples
List Base Models
Pagination
Iterate All Models
Filter Gemini Models
List Models by Capability
List Tuned Models (Vertex AI)
Filter Models (Vertex AI)
Get Model Details
Async Usage
Compare Model Capabilities
Pagination Notes
ThePager object supports two iteration patterns:
- Iterate all models (automatic pagination):
- Manual pagination (more control):
Notes
- Default behavior lists base models (
query_base=True) - Set
query_base=Falseto list your tuned models - Pagination is handled automatically when iterating over the
Pager - Use
page_sizeto control number of results per request - Model availability varies by API (Gemini API vs Vertex AI)
- Some model properties may be
Noneif not applicable - Filter expressions are only supported on Vertex AI
- Tuned model listing requires Vertex AI and appropriate permissions
Related Methods
- generate_content - Use a model for generation
- embed_content - Use a model for embeddings
Use
client.models.get(model='model-name') to retrieve detailed information about a specific model. See the Models concept guide for examples.