speech.mjs 803 B

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