Skip to content

release: 1.91.0 #2423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 23, 2025
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.90.0"
".": "1.91.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 111
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-f411a68f272b8be0ab0c266043da33228687b9b2d76896724e3cef797de9563d.yml
openapi_spec_hash: 89bf866ea95ecfb3d76c8833237047d6
config_hash: dc5515e257676a27cb1ace1784aa92b3
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-ef4ecb19eb61e24c49d77fef769ee243e5279bc0bdbaee8d0f8dba4da8722559.yml
openapi_spec_hash: 1b8a9767c9f04e6865b06c41948cdc24
config_hash: fd2af1d5eff0995bb7dc02ac9a34851d
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 1.91.0 (2025-06-23)

Full Changelog: [v1.90.0...v1.91.0](https://github.com/openai/openai-python/compare/v1.90.0...v1.91.0)

### Features

* **api:** update api shapes for usage and code interpreter ([060d566](https://github.com/openai/openai-python/commit/060d5661e4a1fcdb953c52facd3e668ee80f9295))

## 1.90.0 (2025-06-20)

Full Changelog: [v1.89.0...v1.90.0](https://github.com/openai/openai-python/compare/v1.89.0...v1.90.0)
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ from openai.types.fine_tuning.checkpoints import (
Methods:

- <code title="post /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">create</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_create_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_create_response.py">SyncPage[PermissionCreateResponse]</a></code>
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">retrieve</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_retrieve_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_retrieve_response.py">SyncCursorPage[PermissionRetrieveResponse]</a></code>
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">retrieve</a>(fine_tuned_model_checkpoint, \*\*<a href="src/openai/types/fine_tuning/checkpoints/permission_retrieve_params.py">params</a>) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_retrieve_response.py">PermissionRetrieveResponse</a></code>
- <code title="delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}">client.fine_tuning.checkpoints.permissions.<a href="./src/openai/resources/fine_tuning/checkpoints/permissions.py">delete</a>(permission_id, \*, fine_tuned_model_checkpoint) -> <a href="./src/openai/types/fine_tuning/checkpoints/permission_delete_response.py">PermissionDeleteResponse</a></code>

## Alpha
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "openai"
version = "1.90.0"
version = "1.91.0"
description = "The official Python library for the openai API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/openai/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "openai"
__version__ = "1.90.0" # x-release-please-version
__version__ = "1.91.0" # x-release-please-version
14 changes: 12 additions & 2 deletions src/openai/resources/audio/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def create(
instructions: str | NotGiven = NOT_GIVEN,
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
stream_format: Literal["sse", "audio"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -85,7 +86,10 @@ def create(
`wav`, and `pcm`.

speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default. Does not work with `gpt-4o-mini-tts`.
the default.

stream_format: The format to stream the audio in. Supported formats are `sse` and `audio`.
`sse` is not supported for `tts-1` or `tts-1-hd`.

extra_headers: Send extra headers

Expand All @@ -106,6 +110,7 @@ def create(
"instructions": instructions,
"response_format": response_format,
"speed": speed,
"stream_format": stream_format,
},
speech_create_params.SpeechCreateParams,
),
Expand Down Expand Up @@ -147,6 +152,7 @@ async def create(
instructions: str | NotGiven = NOT_GIVEN,
response_format: Literal["mp3", "opus", "aac", "flac", "wav", "pcm"] | NotGiven = NOT_GIVEN,
speed: float | NotGiven = NOT_GIVEN,
stream_format: Literal["sse", "audio"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -176,7 +182,10 @@ async def create(
`wav`, and `pcm`.

speed: The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
the default. Does not work with `gpt-4o-mini-tts`.
the default.

stream_format: The format to stream the audio in. Supported formats are `sse` and `audio`.
`sse` is not supported for `tts-1` or `tts-1-hd`.

extra_headers: Send extra headers

Expand All @@ -197,6 +206,7 @@ async def create(
"instructions": instructions,
"response_format": response_format,
"speed": speed,
"stream_format": stream_format,
},
speech_create_params.SpeechCreateParams,
),
Expand Down
22 changes: 10 additions & 12 deletions src/openai/resources/fine_tuning/checkpoints/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

from .... import _legacy_response
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._utils import maybe_transform
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper
from ....pagination import SyncPage, AsyncPage, SyncCursorPage, AsyncCursorPage
from ....pagination import SyncPage, AsyncPage
from ...._base_client import AsyncPaginator, make_request_options
from ....types.fine_tuning.checkpoints import permission_create_params, permission_retrieve_params
from ....types.fine_tuning.checkpoints.permission_create_response import PermissionCreateResponse
Expand Down Expand Up @@ -101,7 +101,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncCursorPage[PermissionRetrieveResponse]:
) -> PermissionRetrieveResponse:
"""
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

Expand Down Expand Up @@ -129,9 +129,8 @@ def retrieve(
raise ValueError(
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
)
return self._get_api_list(
return self._get(
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
page=SyncCursorPage[PermissionRetrieveResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -147,7 +146,7 @@ def retrieve(
permission_retrieve_params.PermissionRetrieveParams,
),
),
model=PermissionRetrieveResponse,
cast_to=PermissionRetrieveResponse,
)

def delete(
Expand Down Expand Up @@ -256,7 +255,7 @@ def create(
method="post",
)

def retrieve(
async def retrieve(
self,
fine_tuned_model_checkpoint: str,
*,
Expand All @@ -270,7 +269,7 @@ def retrieve(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[PermissionRetrieveResponse, AsyncCursorPage[PermissionRetrieveResponse]]:
) -> PermissionRetrieveResponse:
"""
**NOTE:** This endpoint requires an [admin API key](../admin-api-keys).

Expand Down Expand Up @@ -298,15 +297,14 @@ def retrieve(
raise ValueError(
f"Expected a non-empty value for `fine_tuned_model_checkpoint` but received {fine_tuned_model_checkpoint!r}"
)
return self._get_api_list(
return await self._get(
f"/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions",
page=AsyncCursorPage[PermissionRetrieveResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
query=maybe_transform(
query=await async_maybe_transform(
{
"after": after,
"limit": limit,
Expand All @@ -316,7 +314,7 @@ def retrieve(
permission_retrieve_params.PermissionRetrieveParams,
),
),
model=PermissionRetrieveResponse,
cast_to=PermissionRetrieveResponse,
)

async def delete(
Expand Down
10 changes: 8 additions & 2 deletions src/openai/types/audio/speech_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ class SpeechCreateParams(TypedDict, total=False):
speed: float
"""The speed of the generated audio.
Select a value from `0.25` to `4.0`. `1.0` is the default. Does not work with
`gpt-4o-mini-tts`.
Select a value from `0.25` to `4.0`. `1.0` is the default.
"""

stream_format: Literal["sse", "audio"]
"""The format to stream the audio in.
Supported formats are `sse` and `audio`. `sse` is not supported for `tts-1` or
`tts-1-hd`.
"""
45 changes: 43 additions & 2 deletions src/openai/types/audio/transcription.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing import List, Union, Optional
from typing_extensions import Literal, Annotated, TypeAlias

from ..._utils import PropertyInfo
from ..._models import BaseModel

__all__ = ["Transcription", "Logprob"]
__all__ = ["Transcription", "Logprob", "Usage", "UsageTokens", "UsageTokensInputTokenDetails", "UsageDuration"]


class Logprob(BaseModel):
Expand All @@ -18,6 +20,42 @@ class Logprob(BaseModel):
"""The log probability of the token."""


class UsageTokensInputTokenDetails(BaseModel):
audio_tokens: Optional[int] = None
"""Number of audio tokens billed for this request."""

text_tokens: Optional[int] = None
"""Number of text tokens billed for this request."""


class UsageTokens(BaseModel):
input_tokens: int
"""Number of input tokens billed for this request."""

output_tokens: int
"""Number of output tokens generated."""

total_tokens: int
"""Total number of tokens used (input + output)."""

type: Literal["tokens"]
"""The type of the usage object. Always `tokens` for this variant."""

input_token_details: Optional[UsageTokensInputTokenDetails] = None
"""Details about the input tokens billed for this request."""


class UsageDuration(BaseModel):
duration: float
"""Duration of the input audio in seconds."""

type: Literal["duration"]
"""The type of the usage object. Always `duration` for this variant."""


Usage: TypeAlias = Annotated[Union[UsageTokens, UsageDuration], PropertyInfo(discriminator="type")]


class Transcription(BaseModel):
text: str
"""The transcribed text."""
Expand All @@ -28,3 +66,6 @@ class Transcription(BaseModel):
Only returned with the models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`
if `logprobs` is added to the `include` array.
"""

usage: Optional[Usage] = None
"""Token usage statistics for the request."""
30 changes: 29 additions & 1 deletion src/openai/types/audio/transcription_text_done_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from ..._models import BaseModel

__all__ = ["TranscriptionTextDoneEvent", "Logprob"]
__all__ = ["TranscriptionTextDoneEvent", "Logprob", "Usage", "UsageInputTokenDetails"]


class Logprob(BaseModel):
Expand All @@ -19,6 +19,31 @@ class Logprob(BaseModel):
"""The log probability of the token."""


class UsageInputTokenDetails(BaseModel):
audio_tokens: Optional[int] = None
"""Number of audio tokens billed for this request."""

text_tokens: Optional[int] = None
"""Number of text tokens billed for this request."""


class Usage(BaseModel):
input_tokens: int
"""Number of input tokens billed for this request."""

output_tokens: int
"""Number of output tokens generated."""

total_tokens: int
"""Total number of tokens used (input + output)."""

type: Literal["tokens"]
"""The type of the usage object. Always `tokens` for this variant."""

input_token_details: Optional[UsageInputTokenDetails] = None
"""Details about the input tokens billed for this request."""


class TranscriptionTextDoneEvent(BaseModel):
text: str
"""The text that was transcribed."""
Expand All @@ -33,3 +58,6 @@ class TranscriptionTextDoneEvent(BaseModel):
[create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
with the `include[]` parameter set to `logprobs`.
"""

usage: Optional[Usage] = None
"""Usage statistics for models billed by token usage."""
14 changes: 13 additions & 1 deletion src/openai/types/audio/transcription_verbose.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import List, Optional
from typing_extensions import Literal

from ..._models import BaseModel
from .transcription_word import TranscriptionWord
from .transcription_segment import TranscriptionSegment

__all__ = ["TranscriptionVerbose"]
__all__ = ["TranscriptionVerbose", "Usage"]


class Usage(BaseModel):
duration: float
"""Duration of the input audio in seconds."""

type: Literal["duration"]
"""The type of the usage object. Always `duration` for this variant."""


class TranscriptionVerbose(BaseModel):
Expand All @@ -22,5 +31,8 @@ class TranscriptionVerbose(BaseModel):
segments: Optional[List[TranscriptionSegment]] = None
"""Segments of the transcribed text and their corresponding details."""

usage: Optional[Usage] = None
"""Usage statistics for models billed by audio input duration."""

words: Optional[List[TranscriptionWord]] = None
"""Extracted words and their corresponding timestamps."""
10 changes: 5 additions & 5 deletions src/openai/types/beta/realtime/session_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from __future__ import annotations

from typing import List, Union, Iterable
from typing_extensions import Literal, TypeAlias, TypedDict
from typing_extensions import Literal, Required, TypeAlias, TypedDict

__all__ = [
"SessionCreateParams",
"ClientSecret",
"ClientSecretExpiresAt",
"ClientSecretExpiresAfter",
"InputAudioNoiseReduction",
"InputAudioTranscription",
"Tool",
Expand Down Expand Up @@ -156,8 +156,8 @@ class SessionCreateParams(TypedDict, total=False):
"""


class ClientSecretExpiresAt(TypedDict, total=False):
anchor: Literal["created_at"]
class ClientSecretExpiresAfter(TypedDict, total=False):
anchor: Required[Literal["created_at"]]
"""The anchor point for the ephemeral token expiration.

Only `created_at` is currently supported.
Expand All @@ -171,7 +171,7 @@ class ClientSecretExpiresAt(TypedDict, total=False):


class ClientSecret(TypedDict, total=False):
expires_at: ClientSecretExpiresAt
expires_after: ClientSecretExpiresAfter
"""Configuration for the ephemeral token expiration."""


Expand Down
Loading