Skip to content

[DOCS] Document TypeScript SDK createSpeech (Audio API) method #615

Closed

Description

Summary

The TypeScript SDK added a new public client method for the OpenAI-compatible Audio API (POST /v1/audio/speech), implemented in inference-gateway/typescript-sdk#221. The docs do not cover it yet.

New public surface:

  • InferenceGatewayClient.createSpeech(request: SchemaCreateSpeechRequest, provider?: Provider): Promise<Blob> - returns the synthesized audio as a Blob; the blob type reflects the requested response_format (e.g. audio/mpeg for mp3)
  • Generated types: SchemaCreateSpeechRequest, CreateSpeechRequestResponse_format (mp3, opus, aac, flac, wav, pcm)

Behavior worth documenting:

  • input is capped at 4096 characters
  • reference_audio is a base64-encoded sample for zero-shot voice cloning; not supported by OpenAI
  • Providers without speech support return 400 with "The Audio API is not supported by this provider yet."
  • The gateway gates the endpoint behind the ENABLE_AUDIO env var (default false), similar to ENABLE_IMAGES

Acceptance Criteria

  • TypeScript SDK docs list the createSpeech method and describe the returned Blob
  • A short text-to-speech usage example (model, input, voice, optional provider) is included
  • Not-supported-provider error behavior and ENABLE_AUDIO gating are documented

Activity

  1. added
    documentation
    on Aug 31, 2026
  2. moved this to Todo in 2026on Aug 31, 2026
  3. added theissue type on Aug 31, 2026
  4. edenreich commented on Aug 31, 2026

    @edenreich
    Contributor

    @claude Can you work on this? use /ponytail:ponytail

  5. inference-gateway-maintainer commented on Aug 31, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Claude finished @edenreich's task in 2m 36s —— View job • docs/issue-615-20260831-1246 • [Create PR ➔](https://github.com/inference-gateway/docs/compare/main...docs/issue-615-20260831-1246?quick_pull=1&title=Issue%20%23615%3A%20Changes%20from%20Claude&body=This%20PR%20addresses%20issue%20%23615%0A%0AGenerated%20with%20%5BClaude%20Code%5D(https%3A%2F%2Fclaude.ai%2Fcode)


    Task: document TypeScript SDK createSpeech

    • Read issue and repo conventions (AGENTS.md/CLAUDE.md)
    • Check the TypeScript SDK source for the exact createSpeech signature and types
    • Add a "Speech synthesis" section to the TypeScript part of sdks.md
    • Fix the Audio API cross-link in api-reference.md (anchors shift)
    • Run lint:md, format:check, build
    • Commit and open PR

    What changed

    • sdks.md - new Speech synthesis section under TypeScript, mirroring the existing Go/Rust sections: createSpeech(request, provider?) -> Promise<Blob> with the blob type following response_format (audio/mpeg for the default mp3), the ENABLE_AUDIO=true gate (404 while disabled), the 400 + The Audio API is not supported by this provider yet. error surfaced as a thrown Error, a text-to-speech example, a SchemaCreateSpeechRequest field table (4096-char input cap, CreateSpeechRequestResponse_format values, base64 reference_audio cloning, not supported by OpenAI), a cloning example and a browser URL.createObjectURL note.
    • api-reference.md - the SDK cross-link now lists TypeScript; Go/Rust anchors become #speech-synthesis-1 / #speech-synthesis-2, verified against the built HTML.

    Signatures, enum casing (Provider.openai, CreateSpeechRequestResponse_format.wav) and error handling were checked against typescript-sdk src/client.ts and the generated types rather than assumed. bun run lint:md, bun run format:check and bun run build all pass.

    PR: #620
    | Branch

  6. moved this from Todo to In progress in 2026on Aug 31, 2026
  7. moved this from In progress to QA in 2026on Aug 31, 2026
  8. moved this from QA to Done in 2026on Aug 31, 2026
  9. inference-gateway-releaser commented on Sep 22, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.9.14 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions