Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .castiron.stats.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
schema_version: 1
generation_id: 118ddabe-fe6b-4298-945e-8c6620ca6518
openapi_spec_hash: ef2dda1aa7b22009e708e923f2d16671
openapi_transformed_spec_hash: 9c2476b34fc1bd1f07ca1c9353122b55
generation_id: e164ac83-c112-4711-be50-ebb428fe3158
openapi_spec_hash: 0fa065837f86231ded0decb63dbdf0b7
openapi_transformed_spec_hash: 89a4e53d02ad69dde25fe7b073c64609
config_hash: 0e042fd083471fc089bcbfe7011a7d01
codegen_sha: 9296df390e1dc6119238e97fd60cd3b5cf6a86ac
codegen_hash: 97a6b18a5145df17893b2cb178d490c1fa4f075cd46b022e8439b29a6df3c979
codegen_sha: 3f4c502584c527f11658bdeb8c487e8cee0ed4da
codegen_hash: a13510d3bcce387fb660ffbe32d7a3155e53c9b19fe9339d4ff1dd4e4211335c
140 changes: 139 additions & 1 deletion api_reference/openapi.transformed.yml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions examples/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ def main() -> None:
)
print(transcription.text)

# Create translation from audio file
translation = openai.audio.translations.create(
# Legacy translation endpoint: shuts down February 26, 2027.
# New integrations should use Realtime translations instead:
# https://developers.openai.com/api/docs/deprecations
translation = openai.audio.translations.create( # pyright: ignore[reportDeprecated]
model="whisper-1",
file=speech_file_path,
)
Expand Down
94 changes: 47 additions & 47 deletions scripts/castiron/generated-files.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions src/openai/resources/audio/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ def create(

Returns the audio file content, or a stream of audio events.

The `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, `gpt-4o-mini-tts-2025-03-20`, and
`gpt-4o-mini-tts-2025-12-15` models are deprecated and scheduled to shut down on
January 6, 2027. These examples use the existing Speech API; for new
integrations, migrate to `gpt-realtime-2.1-mini` through the
[Realtime API](https://developers.openai.com/api/docs/guides/realtime). See the
[deprecation schedule](https://developers.openai.com/api/docs/deprecations) for
migration details.

Args:
input: The text to generate audio for. The maximum length is 4096 characters.

Expand All @@ -77,6 +85,13 @@ def create(
[TTS models](https://developers.openai.com/api/docs/guides/text-to-speech):
`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.

Deprecated values:

- "tts-1", "tts-1-hd", "gpt-4o-mini-tts", "gpt-4o-mini-tts-2025-12-15":
Announced shutdown date: 2027-01-06. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

voice: The voice to use when generating the audio. Supported built-in voices are
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
`shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
Expand Down Expand Up @@ -176,6 +191,14 @@ async def create(

Returns the audio file content, or a stream of audio events.

The `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, `gpt-4o-mini-tts-2025-03-20`, and
`gpt-4o-mini-tts-2025-12-15` models are deprecated and scheduled to shut down on
January 6, 2027. These examples use the existing Speech API; for new
integrations, migrate to `gpt-realtime-2.1-mini` through the
[Realtime API](https://developers.openai.com/api/docs/guides/realtime). See the
[deprecation schedule](https://developers.openai.com/api/docs/deprecations) for
migration details.

Args:
input: The text to generate audio for. The maximum length is 4096 characters.

Expand All @@ -184,6 +207,13 @@ async def create(
[TTS models](https://developers.openai.com/api/docs/guides/text-to-speech):
`tts-1`, `tts-1-hd`, `gpt-4o-mini-tts`, or `gpt-4o-mini-tts-2025-12-15`.

Deprecated values:

- "tts-1", "tts-1-hd", "gpt-4o-mini-tts", "gpt-4o-mini-tts-2025-12-15":
Announced shutdown date: 2027-01-06. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

voice: The voice to use when generating the audio. Supported built-in voices are
`alloy`, `ash`, `ballad`, `coral`, `echo`, `fable`, `onyx`, `nova`, `sage`,
`shimmer`, `verse`, `marin`, and `cedar`. You may also provide a custom voice
Expand Down
64 changes: 64 additions & 0 deletions src/openai/resources/audio/transcriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,14 @@ def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

chunking_strategy: Controls how the audio is cut into chunks. When set to `"auto"`, the server
first normalizes loudness and then uses voice activity detection (VAD) to choose
boundaries. `server_vad` object can be provided to tweak VAD detection
Expand Down Expand Up @@ -343,6 +351,14 @@ def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
Expand Down Expand Up @@ -465,6 +481,14 @@ def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
Expand Down Expand Up @@ -587,6 +611,14 @@ def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

chunking_strategy: Controls how the audio is cut into chunks. When set to `"auto"`, the server
first normalizes loudness and then uses voice activity detection (VAD) to choose
boundaries. `server_vad` object can be provided to tweak VAD detection
Expand Down Expand Up @@ -879,6 +911,14 @@ async def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

chunking_strategy: Controls how the audio is cut into chunks. When set to `"auto"`, the server
first normalizes loudness and then uses voice activity detection (VAD) to choose
boundaries. `server_vad` object can be provided to tweak VAD detection
Expand Down Expand Up @@ -1001,6 +1041,14 @@ async def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
Expand Down Expand Up @@ -1123,6 +1171,14 @@ async def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

stream: If set to true, the model response data will be streamed to the client as it is
generated using
[server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).
Expand Down Expand Up @@ -1245,6 +1301,14 @@ async def create(
(which is powered by our open source Whisper V2 model), and
`gpt-4o-transcribe-diarize`.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

chunking_strategy: Controls how the audio is cut into chunks. When set to `"auto"`, the server
first normalizes loudness and then uses voice activity detection (VAD) to choose
boundaries. `server_vad` object can be provided to tweak VAD detection
Expand Down
63 changes: 55 additions & 8 deletions src/openai/resources/audio/translations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from __future__ import annotations

import logging
import typing_extensions
from typing import Union, Mapping, cast
from typing_extensions import Literal, overload

Expand Down Expand Up @@ -61,6 +62,7 @@ def with_streaming_response(self) -> TranslationsWithStreamingResponse:
return TranslationsWithStreamingResponse(self)

@overload
@typing_extensions.deprecated("deprecated", category=None)
def create(
self,
*,
Expand All @@ -78,6 +80,7 @@ def create(
) -> Translation: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
def create(
self,
*,
Expand All @@ -95,6 +98,7 @@ def create(
) -> TranslationVerbose: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
def create(
self,
*,
Expand All @@ -112,6 +116,7 @@ def create(
) -> str: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
def create(
self,
*,
Expand All @@ -128,6 +133,7 @@ def create(
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
) -> Translation | TranslationVerbose | str: ...

@typing_extensions.deprecated("deprecated")
def create(
self,
*,
Expand All @@ -146,6 +152,12 @@ def create(
"""
Translates audio into English.

This endpoint supports only `whisper-1`. The endpoint and model are deprecated
and scheduled to shut down on February 26, 2027. Migrate to
`/v1/realtime/translations`, which requires a separate integration. See the
[deprecation schedule](https://developers.openai.com/api/docs/deprecations) for
details.

Args:
file: The audio file object (not file name) translate, in one of these formats: flac,
mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough
Expand All @@ -155,6 +167,14 @@ def create(
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
Whisper V2 model) is currently available.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

prompt: An optional text to guide the model's style or continue a previous audio
segment. The
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
Expand Down Expand Up @@ -230,6 +250,7 @@ def with_streaming_response(self) -> AsyncTranslationsWithStreamingResponse:
return AsyncTranslationsWithStreamingResponse(self)

@overload
@typing_extensions.deprecated("deprecated", category=None)
async def create(
self,
*,
Expand All @@ -247,6 +268,7 @@ async def create(
) -> Translation: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
async def create(
self,
*,
Expand All @@ -264,6 +286,7 @@ async def create(
) -> TranslationVerbose: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
async def create(
self,
*,
Expand All @@ -281,6 +304,7 @@ async def create(
) -> str: ...

@overload
@typing_extensions.deprecated("deprecated", category=None)
async def create(
self,
*,
Expand All @@ -297,6 +321,7 @@ async def create(
timeout: float | httpx2.Timeout | None | NotGiven = not_given,
) -> Translation | TranslationVerbose | str: ...

@typing_extensions.deprecated("deprecated")
async def create(
self,
*,
Expand All @@ -315,6 +340,12 @@ async def create(
"""
Translates audio into English.

This endpoint supports only `whisper-1`. The endpoint and model are deprecated
and scheduled to shut down on February 26, 2027. Migrate to
`/v1/realtime/translations`, which requires a separate integration. See the
[deprecation schedule](https://developers.openai.com/api/docs/deprecations) for
details.

Args:
file: The audio file object (not file name) translate, in one of these formats: flac,
mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough
Expand All @@ -324,6 +355,14 @@ async def create(
model: ID of the model to use. Only `whisper-1` (which is powered by our open source
Whisper V2 model) is currently available.

Deprecated values:

- "whisper-1", "gpt-4o-transcribe", "gpt-4o-mini-transcribe",
"gpt-4o-mini-transcribe-2025-12-15", "gpt-4o-transcribe-diarize": Announced
shutdown date: 2027-02-26. See
https://developers.openai.com/api/docs/deprecations for details and
recommended replacements.

prompt: An optional text to guide the model's style or continue a previous audio
segment. The
[prompt](https://developers.openai.com/api/docs/guides/speech-to-text#prompting)
Expand Down Expand Up @@ -380,33 +419,41 @@ class TranslationsWithRawResponse:
def __init__(self, translations: Translations) -> None:
self._translations = translations

self.create = _legacy_response.to_raw_response_wrapper(
translations.create,
self.create = ( # pyright: ignore[reportDeprecated]
_legacy_response.to_raw_response_wrapper(
translations.create, # pyright: ignore[reportDeprecated],
)
)


class AsyncTranslationsWithRawResponse:
def __init__(self, translations: AsyncTranslations) -> None:
self._translations = translations

self.create = _legacy_response.async_to_raw_response_wrapper(
translations.create,
self.create = ( # pyright: ignore[reportDeprecated]
_legacy_response.async_to_raw_response_wrapper(
translations.create, # pyright: ignore[reportDeprecated],
)
)


class TranslationsWithStreamingResponse:
def __init__(self, translations: Translations) -> None:
self._translations = translations

self.create = to_streamed_response_wrapper(
translations.create,
self.create = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
translations.create, # pyright: ignore[reportDeprecated],
)
)


class AsyncTranslationsWithStreamingResponse:
def __init__(self, translations: AsyncTranslations) -> None:
self._translations = translations

self.create = async_to_streamed_response_wrapper(
translations.create,
self.create = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
translations.create, # pyright: ignore[reportDeprecated],
)
)
Loading
Loading