Skip to main content

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 a Pager[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

The Pager object supports two iteration patterns:
  1. Iterate all models (automatic pagination):
  1. Manual pagination (more control):

Notes

  • Default behavior lists base models (query_base=True)
  • Set query_base=False to list your tuned models
  • Pagination is handled automatically when iterating over the Pager
  • Use page_size to control number of results per request
  • Model availability varies by API (Gemini API vs Vertex AI)
  • Some model properties may be None if not applicable
  • Filter expressions are only supported on Vertex AI
  • Tuned model listing requires Vertex AI and appropriate permissions
Use client.models.get(model='model-name') to retrieve detailed information about a specific model. See the Models concept guide for examples.