speech.js 932 B

1234567891011121314151617181920212223242526272829303132
  1. "use strict";
  2. // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
  3. Object.defineProperty(exports, "__esModule", { value: true });
  4. exports.Speech = void 0;
  5. const resource_1 = require("../../resource.js");
  6. class Speech extends resource_1.APIResource {
  7. /**
  8. * Generates audio from the input text.
  9. *
  10. * @example
  11. * ```ts
  12. * const speech = await client.audio.speech.create({
  13. * input: 'input',
  14. * model: 'string',
  15. * voice: 'ash',
  16. * });
  17. *
  18. * const content = await speech.blob();
  19. * console.log(content);
  20. * ```
  21. */
  22. create(body, options) {
  23. return this._client.post('/audio/speech', {
  24. body,
  25. ...options,
  26. headers: { Accept: 'application/octet-stream', ...options?.headers },
  27. __binaryResponse: true,
  28. });
  29. }
  30. }
  31. exports.Speech = Speech;
  32. //# sourceMappingURL=speech.js.map