Skip to content

[DOCS] Document the new /audio/speech operation (text-to-speech through the gateway) #600

Closed

Description

Summary

The Inference Gateway API gained a new operation: POST /v1/audio/speech (operation id createSpeech), defined in openapi.yaml on the branch for PR inference-gateway/schemas#185 and resolving inference-gateway/schemas#184. It mirrors OpenAI's POST /v1/audio/speech: the request body is model, input, voice, response_format, speed, and the response is raw audio bytes (audio/mpeg, audio/opus, audio/aac, audio/flac, audio/wav, audio/pcm) rather than JSON - the first binary response in the spec.

This lets text-to-speech traffic go through the gateway and show up in gateway logs, tracing and pricing, instead of clients shelling out to a local TTS binary (see inference-gateway/cli#1126).

The docs repo is not being edited directly from that PR, so documentation for the new operation is tracked here.

Acceptance Criteria

  • The /audio/speech operation is documented wherever the Images API operations (/images/generations, /images/edits, /images/variations) are documented, including the request body fields and the supported response_format audio media types.
  • The binary (non-JSON, audio/*) response body nature of the operation is made explicit for users, since every other gateway endpoint returns JSON.
  • Any supported-client guides (e.g. CLI text-to-speech tooling) note that TTS can be routed through the gateway using model, voice and response_format.
  • The not-supported behavior is documented: providers without speech synthesis support return 400 with a not-supported error (see SpeechNotSupported in the spec).

Reference: spec change in inference-gateway/schemas#185 (source of truth inference-gateway/schemas, openapi.yaml).

Activity

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

    @edenreich
    Contributor

    @claude Can you document this? check all the relevant info on the gateway first. use /ponytail:ponytail

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

    @inference-gateway-maintainer
    ContributorAuthor

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


    Documenting POST /v1/audio/speech

    • Gather context (issue + repo conventions)
    • Check source of truth: schemas/openapi.yaml on main (createSpeech, CreateSpeechRequest, SpeechNotSupported, ENABLE_AUDIO) and the gateway's tests/api_speech_test.go for actual runtime behavior
    • Locate where the Images API is documented (api-reference.md, sdks.md)
    • Add the Audio API section to api-reference.md
    • Add ENABLE_AUDIO (and the missing ENABLE_IMAGES) to configuration.md
    • Note gateway routing in cli-text-to-speech.md
    • Validate: bun run lint:md, bun run format:check, bun run build all pass
    • Commit + open PR

    PR: #608

    What changed

    api-reference.md - new Audio API section right after the Images API:

    • POST /v1/audio/speech?provider={provider}, gated on ENABLE_AUDIO=true (returns 404 with The Audio API is not enabled... while off - confirmed in the gateway tests, not just the spec).
    • The binary response is called out explicitly: not JSON, raw audio bytes, with a response_format -> response Content-Type table (mp3->audio/mpeg, opus, aac, flac, wav, pcm), and a curl example that writes to a file rather than the terminal.
    • Full CreateSpeechRequest field table: model, input (4096 char max), voice (the 13 OpenAI built-ins; other providers use their own ids), response_format, speed (0.25-4.0), plus instructions and the reference_audio base64 voice-cloning passthrough that were in the spec but not the issue body.
    • The not-supported path: 400 Bad Request with {"error": "The Audio API is not supported by this provider yet."}.

    configuration.md - added ENABLE_AUDIO to General Settings, plus ENABLE_IMAGES, which was referenced from api-reference.md but never listed. One sentence covers both: 404 while disabled, 400 from providers that do not implement the API (currently openai, plus llamacpp for speech).

    cli-text-to-speech.md - a short section noting TTS can go through the gateway with model, voice and response_format so it lands in gateway logs/tracing/pricing, with a curl example.

    Not done

    • SDK pages untouched. sdks.md documents CreateImage, but no SDK exposes a CreateSpeech method yet - documenting one would be fiction. Worth a follow-up once the SDKs regenerate from the new schema.
    • CLI accuracy note: [FEATURE] Add a gateway-backed TextToSpeech engine alongside local llama-tts cli#1126 (gateway-backed TextToSpeech engine) is still open, so the page says the CLI's own tool still synthesizes locally and links the issue, rather than claiming a feature that has not shipped.
      | 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