You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library provides unofficial Go clients for [OpenAI Realtime API](https://platform.openai.com/docs/api-reference/realtime). We support all 9 client events and 28 server events.
7
+
This library provides unofficial Go clients for [OpenAI Realtime API](https://platform.openai.com/docs/api-reference/realtime). We support all 11 client events and 40 server events (except for 3 WebRTC-Only events).
- gpt-4o-realtime-preview (shutdown date 2026-02-27)
16
+
- gpt-4o-realtime-preview-2024-10-01 (shutdown date 2025-10-10)
17
+
- gpt-4o-realtime-preview-2024-12-17 (shutdown date 2026-02-27)
18
+
- gpt-4o-realtime-preview-2025-06-03 (shutdown date 2026-02-27)
19
+
- gpt-4o-mini-realtime-preview
20
+
- gpt-4o-mini-realtime-preview-2024-12-17
21
+
22
+
23
+
## Migration
24
+
25
+
OpenAI Realtime API GA was officially released on 2025-08-28, and it is not fully compatible with the Beta version.To address these breaking changes,
26
+
we need to develop a v2 version of go-openai-realtime.For details, refer to the [Beta to GA Migration Guide](https://platform.openai.com/docs/guides/realtime#beta-to-ga-migration).
27
+
28
+
Please use `github.com/WqyJh/go-openai-realtime/v2` instead of `github.com/WqyJh/go-openai-realtime`, and update your code to adapt to the new API specifications.
29
+
30
+
Note that the Realtime API Beta and Realtime Preview Models (e.g., gpt-4o-realtime-preview) will be shut down on 2026-02-27. After this date,
31
+
you will no longer be able to use these services or the v1 version of go-openai-realtime.
32
+
33
+
The old v1 version of go-openai-realtime is available at [v1 branch](https://github.com/WqyJh/go-openai-realtime/tree/v1).
Copy file name to clipboardExpand all lines: api.go
+17-47Lines changed: 17 additions & 47 deletions
Original file line number
Diff line number
Diff line change
@@ -9,65 +9,35 @@ import (
9
9
"net/http"
10
10
)
11
11
12
-
typeCreateSessionRequeststruct {
13
-
ClientSession
14
-
15
-
// The Realtime model used for this session.
16
-
Modelstring`json:"model"`
17
-
}
18
-
19
12
typeClientSecretstruct {
20
13
// Ephemeral key usable in client environments to authenticate connections to the Realtime API. Use this in client-side environments rather than a standard API token, which should only be used server-side.
21
14
Valuestring`json:"value"`
22
15
// Timestamp for when the token expires. Currently, all tokens expire after one minute.
23
16
ExpiresAtint64`json:"expires_at"`
24
17
}
25
18
26
-
typeCreateSessionResponsestruct {
27
-
ServerSession
19
+
typeExpiresAfterstruct {
20
+
// The anchor point for the client secret expiration, meaning that seconds will be added to the created_at time of the client secret to produce an expiration timestamp. Only created_at is currently supported.
21
+
Anchorstring`json:"anchor,omitempty"`
28
22
29
-
// Ephemeral key returned by the API.
30
-
ClientSecretClientSecret`json:"client_secret"`
23
+
// The number of seconds from the anchor point to the expiration. Select a value between 10 and 7200 (2 hours). This default to 600 seconds (10 minutes) if not specified.
24
+
Secondsint`json:"seconds,omitempty"`
31
25
}
32
26
33
-
// CreateTranscriptionSessionRequest is the request for creating a transcription session.
34
-
typeCreateTranscriptionSessionRequeststruct {
35
-
// The set of items to include in the transcription.
36
-
Include []string`json:"include,omitempty"`
37
-
// The format of input audio. Options are "pcm16", "g711_ulaw", or "g711_alaw".
// Configuration for the client secret expiration. Expiration refers to the time after which a client secret will no longer be valid for creating sessions. The session itself may continue after that time once started. A secret can be used to create multiple sessions until it expires.
0 commit comments