Skip to content

[FEATURE] docs: add an audio example for create_speech, create_sfx and create_music #174

Description

Summary

Domain: audio. The client exposes create_speech (POST /audio/speech), create_sfx (POST /audio/sfx, from a text prompt or by scoring a video) and create_music (POST /audio/music). They were added in v0.19.0 and create_sfx gained video scoring in v0.25.0, but no example demonstrates any of them: there is no examples/audio/ directory and the root README.md does not mention speech, sound effects or music at all. A user cannot learn from the README that these methods return raw audio bytes instead of a response model, that the gateway needs AUDIO_ENABLED=true, or which create_sfx arguments apply to a text prompt versus a video.

Acceptance Criteria

  • Add examples/audio/main.py that calls client.create_speech(model=..., input=..., voice=...) and writes the returned bytes to a file, taking the model from an env var like the other examples.
  • In examples/audio/main.py, call client.create_sfx(model=..., prompt=..., duration_seconds=...) for text-to-sfx and, when a VIDEO_URL env var is set, client.create_sfx(model=..., video=..., output="sfx") to score a video.
  • In examples/audio/main.py, call client.create_music(model=..., prompt=..., duration_seconds=..., instrumental=True) and save the clip.
  • Add examples/audio/README.md covering the prerequisites (AUDIO_ENABLED=true on the gateway and a provider with audio support such as openai, elevenlabs or mirelo), the response_format argument and the 400 error returned by providers without support.
  • Add a short "Audio" section to the root README.md with a create_speech snippet, and list the new example in the README.md "Examples" section and in examples/README.md.

Activity

  1. edenreich commented on Nov 17, 2026

    @edenreich
    Contributor

    @claude can you work on this?

  2. inference-gateway-maintainer commented on Nov 17, 2026

    @inference-gateway-maintainer
    ContributorAuthor

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


    Audio example added

    What changed

    • examples/audio/main.py calls create_speech, create_sfx (from a text prompt, and from a video when VIDEO_URL is set, with output="sfx") and create_music(instrumental=True). Each result is raw bytes and is saved to an .mp3 file. Models come from SPEECH_MODEL, SFX_MODEL, MUSIC_MODEL and VIDEO_SFX_MODEL.
    • examples/audio/README.md explains:
      • the setup you need: AUDIO_ENABLED=true and a provider with audio support (openai, elevenlabs or mirelo)
      • the 400 error from providers that don't support audio
      • which create_sfx arguments apply to a text prompt and which apply to a video
      • the response_format argument
    • The root README.md has a new "Audio" section with a create_speech snippet. The new example is also listed in both README.md "Examples" and examples/README.md.

    What I couldn't check

    • task lint didn't run because black, isort and mypy aren't installed in this sandbox, and installing the dev dependencies needed approval. I only syntax-checked the new file with py_compile.
    • I didn't run the example against a real gateway.
    • I didn't open a [DOCS] issue because this PR only changes examples and README text, not SDK behavior. The PR body says so.
      | Branch
  3. moved this from Todo to In progress in 2026on Nov 17, 2026
  4. moved this from In progress to QA in 2026on Nov 17, 2026
  5. moved this from QA to Done in 2026on Nov 17, 2026
  6. inference-gateway-releaser commented on Nov 17, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.26.0 🎉

    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

    enhancementreleased

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions