java/resources/models/index.md +0 −235 deleted
File Deleted View Diff
1# Models
2
3## List models
4
5`ModelListPage models().list(ModelListParamsparams = ModelListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
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### Parameters
12
13- `ModelListParams params`
14
15### Returns
16
17- `class Model:`
18
19 Describes an OpenAI model offering that can be used with the API.
20
21 - `String id`
22
23 The model identifier, which can be referenced in the API endpoints.
24
25 - `long created`
26
27 The Unix timestamp (in seconds) when the model was created.
28
29 - `JsonValue; object_ "model"constant`
30
31 The object type, which is always "model".
32
33 - `MODEL("model")`
34
35 - `String ownedBy`
36
37 The organization that owns the model.
38
39### Example
40
41```java
42package com.openai.example;
43
44import com.openai.client.OpenAIClient;
45import com.openai.client.okhttp.OpenAIOkHttpClient;
46import com.openai.models.models.ModelListPage;
47import com.openai.models.models.ModelListParams;
48
49public final class Main {
50 private Main() {}
51
52 public static void main(String[] args) {
53 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
54
55 ModelListPage page = client.models().list();
56 }
57}
58```
59
60#### Response
61
62```json
63{
64 "data": [
65 {
66 "id": "id",
67 "created": 0,
68 "object": "model",
69 "owned_by": "owned_by"
70 }
71 ],
72 "object": "list"
73}
74```
75
76## Retrieve model
77
78`Model models().retrieve(ModelRetrieveParamsparams = ModelRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
79
80**get** `/models/{model}`
81
82Retrieves a model instance, providing basic information about the model such as the owner and permissioning.
83
84### Parameters
85
86- `ModelRetrieveParams params`
87
88 - `Optional<String> model`
89
90### Returns
91
92- `class Model:`
93
94 Describes an OpenAI model offering that can be used with the API.
95
96 - `String id`
97
98 The model identifier, which can be referenced in the API endpoints.
99
100 - `long created`
101
102 The Unix timestamp (in seconds) when the model was created.
103
104 - `JsonValue; object_ "model"constant`
105
106 The object type, which is always "model".
107
108 - `MODEL("model")`
109
110 - `String ownedBy`
111
112 The organization that owns the model.
113
114### Example
115
116```java
117package com.openai.example;
118
119import com.openai.client.OpenAIClient;
120import com.openai.client.okhttp.OpenAIOkHttpClient;
121import com.openai.models.models.Model;
122import com.openai.models.models.ModelRetrieveParams;
123
124public final class Main {
125 private Main() {}
126
127 public static void main(String[] args) {
128 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
129
130 Model model = client.models().retrieve("gpt-4o-mini");
131 }
132}
133```
134
135#### Response
136
137```json
138{
139 "id": "id",
140 "created": 0,
141 "object": "model",
142 "owned_by": "owned_by"
143}
144```
145
146## Delete a fine-tuned model
147
148`ModelDeleted models().delete(ModelDeleteParamsparams = ModelDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
149
150**delete** `/models/{model}`
151
152Delete a fine-tuned model. You must have the Owner role in your organization to delete a model.
153
154### Parameters
155
156- `ModelDeleteParams params`
157
158 - `Optional<String> model`
159
160### Returns
161
162- `class ModelDeleted:`
163
164 - `String id`
165
166 - `boolean deleted`
167
168 - `String object_`
169
170### Example
171
172```java
173package com.openai.example;
174
175import com.openai.client.OpenAIClient;
176import com.openai.client.okhttp.OpenAIOkHttpClient;
177import com.openai.models.models.ModelDeleteParams;
178import com.openai.models.models.ModelDeleted;
179
180public final class Main {
181 private Main() {}
182
183 public static void main(String[] args) {
184 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
185
186 ModelDeleted modelDeleted = client.models().delete("ft:gpt-4o-mini:acemeco:suffix:abc123");
187 }
188}
189```
190
191#### Response
192
193```json
194{
195 "id": "id",
196 "deleted": true,
197 "object": "object"
198}
199```
200
201## Domain Types
202
203### Model
204
205- `class Model:`
206
207 Describes an OpenAI model offering that can be used with the API.
208
209 - `String id`
210
211 The model identifier, which can be referenced in the API endpoints.
212
213 - `long created`
214
215 The Unix timestamp (in seconds) when the model was created.
216
217 - `JsonValue; object_ "model"constant`
218
219 The object type, which is always "model".
220
221 - `MODEL("model")`
222
223 - `String ownedBy`
224
225 The organization that owns the model.
226
227### Model Deleted
228
229- `class ModelDeleted:`
230
231 - `String id`
232
233 - `boolean deleted`
234
235 - `String object_`