Class: OpenAI::Resources::Realtime::ClientSecrets
- Inherits:
-
Object
- Object
- OpenAI::Resources::Realtime::ClientSecrets
- Defined in:
- lib/openai/resources/realtime/client_secrets.rb
Instance Method Summary collapse
-
#create(expires_after: nil, session: nil, request_options: {}) ⇒ OpenAI::Models::Realtime::ClientSecretCreateResponse
Some parameter documentations has been truncated, see Models::Realtime::ClientSecretCreateParams for more details.
-
#initialize(client:) ⇒ ClientSecrets
constructor
private
A new instance of ClientSecrets.
Constructor Details
#initialize(client:) ⇒ ClientSecrets
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of ClientSecrets.
51 52 53 |
# File 'lib/openai/resources/realtime/client_secrets.rb', line 51 def initialize(client:) @client = client end |
Instance Method Details
#create(expires_after: nil, session: nil, request_options: {}) ⇒ OpenAI::Models::Realtime::ClientSecretCreateResponse
Some parameter documentations has been truncated, see Models::Realtime::ClientSecretCreateParams for more details.
Create a Realtime client secret with an associated session configuration.
Client secrets are short-lived tokens that can be passed to a client app, such as a web frontend or mobile client, which grants access to the Realtime API without leaking your main API key. You can configure a custom TTL for each client secret.
You can also attach session configuration options to the client secret, which will be applied to any sessions created using that client secret, but these can also be overridden by the client connection.
[Learn more about authentication with client secrets over WebRTC](platform.openai.com/docs/guides/realtime-webrtc).
Returns the created client secret and the effective session object. The client secret is a string that looks like ek_1234.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/openai/resources/realtime/client_secrets.rb', line 37 def create(params = {}) parsed, = OpenAI::Realtime::ClientSecretCreateParams.dump_request(params) @client.request( method: :post, path: "realtime/client_secrets", body: parsed, model: OpenAI::Models::Realtime::ClientSecretCreateResponse, options: ) end |