Skip to content

List models

models.list() -> SyncPage[Model]
GET/models

Lists the currently available models, and provides basic information about each one such as the owner and availability.

ReturnsExpand Collapse
class Model:

Describes an OpenAI model offering that can be used with the API.

id: str

The model identifier, which can be referenced in the API endpoints.

created: int

The Unix timestamp (in seconds) when the model was created.

object: Literal["model"]

The object type, which is always "model".

owned_by: str

The organization that owns the model.

List models

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
page = client.models.list()
page = page.data[0]
print(page.id)
{
  "data": [
    {
      "id": "id",
      "created": 0,
      "object": "model",
      "owned_by": "owned_by"
    }
  ],
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "created": 0,
      "object": "model",
      "owned_by": "owned_by"
    }
  ],
  "object": "list"
}