SpyBara
Go Premium

python/resources/models/methods/retrieve/index.md 2026-07-07 08:02 UTC to 2026-07-09 20:58 UTC

81 added, 0 removed.

2026
Sat 25 05:59 Thu 23 18:00 Wed 22 20:02 Mon 20 20:00 Fri 17 17:00 Thu 16 20:57 Wed 15 02:58 Tue 14 06:58 Mon 13 15:59 Sun 12 06:58 Fri 10 23:02 Thu 9 20:58 Tue 7 08:02

Retrieve model

models.retrieve(strmodel) -> Model

get /models/{model}

Retrieve model

Parameters

  • model: str

Returns

  • 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".

      • "model"
    • owned_by: str

      The organization that owns the model.

Example

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("OPENAI_API_KEY"),  # This is the default and can be omitted
)
model = client.models.retrieve(
    "gpt-4o-mini",
)
print(model.id)

Response

{
  "id": "id",
  "created": 0,
  "object": "model",
  "owned_by": "owned_by"
}

Example

from openai import OpenAI
client = OpenAI()

client.models.retrieve("VAR_chat_model_id")

Response

{
  "id": "VAR_chat_model_id",
  "object": "model",
  "created": 1686935002,
  "owned_by": "openai"
}