go/resources/models/methods/retrieve/index.md +0 −71 deleted
File Deleted View Diff
1## Retrieve model
2
3`client.Models.Get(ctx, model) (*Model, error)`
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 string`
12
13### Returns
14
15- `type Model struct{…}`
16
17 Describes an OpenAI model offering that can be used with the API.
18
19 - `ID string`
20
21 The model identifier, which can be referenced in the API endpoints.
22
23 - `Created int64`
24
25 The Unix timestamp (in seconds) when the model was created.
26
27 - `Object Model`
28
29 The object type, which is always "model".
30
31 - `const ModelModel Model = "model"`
32
33 - `OwnedBy string`
34
35 The organization that owns the model.
36
37### Example
38
39```go
40package main
41
42import (
43 "context"
44 "fmt"
45
46 "github.com/openai/openai-go"
47 "github.com/openai/openai-go/option"
48)
49
50func main() {
51 client := openai.NewClient(
52 option.WithAPIKey("My API Key"),
53 )
54 model, err := client.Models.Get(context.TODO(), "gpt-4o-mini")
55 if err != nil {
56 panic(err.Error())
57 }
58 fmt.Printf("%+v\n", model.ID)
59}
60```
61
62#### Response
63
64```json
65{
66 "id": "id",
67 "created": 0,
68 "object": "model",
69 "owned_by": "owned_by"
70}
71```