Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python API Model Type

From Leeroopedia
Knowledge Sources
Domains API_Types, Python
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete tool for representing an OpenAI model object provided by the openai-python SDK.

Description

Model is a Pydantic BaseModel that describes an OpenAI model offering that can be used with the API. It contains the model id (identifier referenced in API endpoints), created Unix timestamp, object type (always "model"), and owned_by (the organization that owns the model). This is the return type from the Models API endpoints for listing and retrieving models.

Usage

Import Model when you need to type-annotate or inspect the response from client.models.list() or client.models.retrieve().

Code Reference

Source Location

Signature

class Model(BaseModel):
    id: str
    created: int
    object: Literal["model"]
    owned_by: str

Import

from openai.types import Model

I/O Contract

Fields

Name Type Required Description
id str Yes The model identifier, which can be referenced in API endpoints.
created int Yes Unix timestamp (in seconds) when the model was created.
object Literal["model"] Yes The object type, always "model".
owned_by str Yes The organization that owns the model.

Usage Examples

from openai import OpenAI
from openai.types import Model

client = OpenAI()

# List all available models
models = client.models.list()
for model in models.data:
    print(f"{model.id} - owned by {model.owned_by}")

# Retrieve a specific model
gpt4: Model = client.models.retrieve("gpt-4")
print(f"Model: {gpt4.id}, Created: {gpt4.created}")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment