python/resources/models/methods/retrieve/index.md +0 −81 deleted
File Deleted View Diff
1## Retrieve model
2
3`models.retrieve(strmodel) -> Model`
4
5**get** `/models/{model}`
6
7Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
8
9### Parameters
10
11- `model: str`
12
13### Returns
14
15- `class Model: …`
16
17 Describes an OpenAI model offering that can be used with the API.
18
19 - `id: str`
20
21 The model identifier, which can be referenced in the API endpoints.
22
23 - `created: int`
24
25 The Unix timestamp (in seconds) when the model was created.
26
27 - `object: Literal["model"]`
28
29 The object type, which is always "model".
30
31 - `"model"`
32
33 - `owned_by: str`
34
35 The organization that owns the model.
36
37### Example
38
39```python
40import os
41from openai import OpenAI
42
43client = OpenAI(
44 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
45)
46model = client.models.retrieve(
47 "gpt-4o-mini",
48)
49print(model.id)
50```
51
52#### Response
53
54```json
55{
56 "id": "id",
57 "created": 0,
58 "object": "model",
59 "owned_by": "owned_by"
60}
61```
62
63### Example
64
65```python
66from openai import OpenAI
67client = OpenAI()
68
69client.models.retrieve("VAR_chat_model_id")
70```
71
72#### Response
73
74```json
75{
76 "id": "VAR_chat_model_id",
77 "object": "model",
78 "created": 1686935002,
79 "owned_by": "openai"
80}
81```