ruby/resources/models/index.md +0 −200 deleted
File Deleted View Diff
1# Models
2
3## List models
4
5`models.list() -> Page<Model>`
6
7**get** `/models`
8
9Lists the currently available models, and provides basic information about each one such as the owner and availability.
10
11### Returns
12
13- `class Model`
14
15 Describes an OpenAI model offering that can be used with the API.
16
17 - `id: String`
18
19 The model identifier, which can be referenced in the API endpoints.
20
21 - `created: Integer`
22
23 The Unix timestamp (in seconds) when the model was created.
24
25 - `object: :model`
26
27 The object type, which is always "model".
28
29 - `:model`
30
31 - `owned_by: String`
32
33 The organization that owns the model.
34
35### Example
36
37```ruby
38require "openai"
39
40openai = OpenAI::Client.new(api_key: "My API Key")
41
42page = openai.models.list
43
44puts(page)
45```
46
47#### Response
48
49```json
50{
51 "data": [
52 {
53 "id": "id",
54 "created": 0,
55 "object": "model",
56 "owned_by": "owned_by"
57 }
58 ],
59 "object": "list"
60}
61```
62
63## Retrieve model
64
65`models.retrieve(model) -> Model`
66
67**get** `/models/{model}`
68
69Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
70
71### Parameters
72
73- `model: String`
74
75### Returns
76
77- `class Model`
78
79 Describes an OpenAI model offering that can be used with the API.
80
81 - `id: String`
82
83 The model identifier, which can be referenced in the API endpoints.
84
85 - `created: Integer`
86
87 The Unix timestamp (in seconds) when the model was created.
88
89 - `object: :model`
90
91 The object type, which is always "model".
92
93 - `:model`
94
95 - `owned_by: String`
96
97 The organization that owns the model.
98
99### Example
100
101```ruby
102require "openai"
103
104openai = OpenAI::Client.new(api_key: "My API Key")
105
106model = openai.models.retrieve("gpt-4o-mini")
107
108puts(model)
109```
110
111#### Response
112
113```json
114{
115 "id": "id",
116 "created": 0,
117 "object": "model",
118 "owned_by": "owned_by"
119}
120```
121
122## Delete a fine-tuned model
123
124`models.delete(model) -> ModelDeleted`
125
126**delete** `/models/{model}`
127
128Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
129
130### Parameters
131
132- `model: String`
133
134### Returns
135
136- `class ModelDeleted`
137
138 - `id: String`
139
140 - `deleted: bool`
141
142 - `object: String`
143
144### Example
145
146```ruby
147require "openai"
148
149openai = OpenAI::Client.new(api_key: "My API Key")
150
151model_deleted = openai.models.delete("ft:gpt-4o-mini:acemeco:suffix:abc123")
152
153puts(model_deleted)
154```
155
156#### Response
157
158```json
159{
160 "id": "id",
161 "deleted": true,
162 "object": "object"
163}
164```
165
166## Domain Types
167
168### Model
169
170- `class Model`
171
172 Describes an OpenAI model offering that can be used with the API.
173
174 - `id: String`
175
176 The model identifier, which can be referenced in the API endpoints.
177
178 - `created: Integer`
179
180 The Unix timestamp (in seconds) when the model was created.
181
182 - `object: :model`
183
184 The object type, which is always "model".
185
186 - `:model`
187
188 - `owned_by: String`
189
190 The organization that owns the model.
191
192### Model Deleted
193
194- `class ModelDeleted`
195
196 - `id: String`
197
198 - `deleted: bool`
199
200 - `object: String`