speech.mjs 880 B

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