java/resources/models/methods/retrieve/index.md +0 −69 deleted
File Deleted View Diff
1## Retrieve model
2
3`Model models().retrieve(ModelRetrieveParamsparams = ModelRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
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- `ModelRetrieveParams params`
12
13 - `Optional<String> model`
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.Model;
47import com.openai.models.models.ModelRetrieveParams;
48
49public final class Main {
50 private Main() {}
51
52 public static void main(String[] args) {
53 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
54
55 Model model = client.models().retrieve("gpt-4o-mini");
56 }
57}
58```
59
60#### Response
61
62```json
63{
64 "id": "id",
65 "created": 0,
66 "object": "model",
67 "owned_by": "owned_by"
68}
69```