sessions.mjs 991 B

123456789101112131415161718192021222324252627
  1. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  2. import { APIResource } from "../../../resource.mjs";
  3. export class Sessions extends APIResource {
  4. /**
  5. * Create an ephemeral API token for use in client-side applications with the
  6. * Realtime API. Can be configured with the same session parameters as the
  7. * `session.update` client event.
  8. *
  9. * It responds with a session object, plus a `client_secret` key which contains a
  10. * usable ephemeral API token that can be used to authenticate browser clients for
  11. * the Realtime API.
  12. *
  13. * @example
  14. * ```ts
  15. * const session =
  16. * await client.beta.realtime.sessions.create();
  17. * ```
  18. */
  19. create(body, options) {
  20. return this._client.post('/realtime/sessions', {
  21. body,
  22. ...options,
  23. headers: { 'OpenAI-Beta': 'assistants=v2', ...options?.headers },
  24. });
  25. }
  26. }
  27. //# sourceMappingURL=sessions.mjs.map