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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "2.41.1"
".": "2.42.0"
}
8 changes: 4 additions & 4 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 262
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-0161cb2a0faadedfc17ff59c7fcad9671962dbd170f83811003c23702148cf36.yml
openapi_spec_hash: 1023c7442d0e2e7e213e8b3a253921c5
config_hash: e02ca1082421dfe55b145c45e95d6126
configured_endpoints: 264
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-4db8edc05bd5503d4aaad74e8b9c783aa1f4d40382a8075c53355bd18dfaf68c.yml
openapi_spec_hash: 2466f6ad496b27334217999202e185c0
config_hash: ef3ce17315a31703e7af0567b3e9738c
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 2.42.0 (2026-06-16)

Full Changelog: [v2.41.1...v2.42.0](https://github.com/openai/openai-python/compare/v2.41.1...v2.42.0)

### Features

* **api:** admin spend_alerts ([6134198](https://github.com/openai/openai-python/commit/6134198a488996c4ff6fca4551afd55fb3294fdc))
* **api:** manual updates ([f337bf4](https://github.com/openai/openai-python/commit/f337bf43276c880d2daf09a5d7f9fc9a886c4bf2))
* **api:** update OpenAPI spec or Stainless config ([7015158](https://github.com/openai/openai-python/commit/7015158c3119acf57af6c20903587cef928530a9))


### Build System

* fix release workflow permissions ([#3389](https://github.com/openai/openai-python/issues/3389)) ([a526ee8](https://github.com/openai/openai-python/commit/a526ee813f085318fe3c6923ac3fa10c1cf56420))
* Use CI environment for examples API key ([#3394](https://github.com/openai/openai-python/issues/3394)) ([d64d811](https://github.com/openai/openai-python/commit/d64d811e82aff724397e32d593e50657fee3f905))

## 2.41.1 (2026-06-05)

Full Changelog: [v2.41.0...v2.41.1](https://github.com/openai/openai-python/compare/v2.41.0...v2.41.1)
Expand Down
2 changes: 2 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,7 @@ from openai.types.admin.organization import OrganizationSpendAlert, Organization
Methods:

- <code title="post /organization/spend_alerts">client.admin.organization.spend_alerts.<a href="./src/openai/resources/admin/organization/spend_alerts.py">create</a>(\*\*<a href="src/openai/types/admin/organization/spend_alert_create_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/organization_spend_alert.py">OrganizationSpendAlert</a></code>
- <code title="get /organization/spend_alerts/{alert_id}">client.admin.organization.spend_alerts.<a href="./src/openai/resources/admin/organization/spend_alerts.py">retrieve</a>(alert_id) -> <a href="./src/openai/types/admin/organization/organization_spend_alert.py">OrganizationSpendAlert</a></code>
- <code title="post /organization/spend_alerts/{alert_id}">client.admin.organization.spend_alerts.<a href="./src/openai/resources/admin/organization/spend_alerts.py">update</a>(alert_id, \*\*<a href="src/openai/types/admin/organization/spend_alert_update_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/organization_spend_alert.py">OrganizationSpendAlert</a></code>
- <code title="get /organization/spend_alerts">client.admin.organization.spend_alerts.<a href="./src/openai/resources/admin/organization/spend_alerts.py">list</a>(\*\*<a href="src/openai/types/admin/organization/spend_alert_list_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/organization_spend_alert.py">SyncConversationCursorPage[OrganizationSpendAlert]</a></code>
- <code title="delete /organization/spend_alerts/{alert_id}">client.admin.organization.spend_alerts.<a href="./src/openai/resources/admin/organization/spend_alerts.py">delete</a>(alert_id) -> <a href="./src/openai/types/admin/organization/organization_spend_alert_deleted.py">OrganizationSpendAlertDeleted</a></code>
Expand Down Expand Up @@ -1154,6 +1155,7 @@ from openai.types.admin.organization.projects import ProjectSpendAlert, ProjectS
Methods:

- <code title="post /organization/projects/{project_id}/spend_alerts">client.admin.organization.projects.spend_alerts.<a href="./src/openai/resources/admin/organization/projects/spend_alerts.py">create</a>(project_id, \*\*<a href="src/openai/types/admin/organization/projects/spend_alert_create_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/projects/project_spend_alert.py">ProjectSpendAlert</a></code>
- <code title="get /organization/projects/{project_id}/spend_alerts/{alert_id}">client.admin.organization.projects.spend_alerts.<a href="./src/openai/resources/admin/organization/projects/spend_alerts.py">retrieve</a>(alert_id, \*, project_id) -> <a href="./src/openai/types/admin/organization/projects/project_spend_alert.py">ProjectSpendAlert</a></code>
- <code title="post /organization/projects/{project_id}/spend_alerts/{alert_id}">client.admin.organization.projects.spend_alerts.<a href="./src/openai/resources/admin/organization/projects/spend_alerts.py">update</a>(alert_id, \*, project_id, \*\*<a href="src/openai/types/admin/organization/projects/spend_alert_update_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/projects/project_spend_alert.py">ProjectSpendAlert</a></code>
- <code title="get /organization/projects/{project_id}/spend_alerts">client.admin.organization.projects.spend_alerts.<a href="./src/openai/resources/admin/organization/projects/spend_alerts.py">list</a>(project_id, \*\*<a href="src/openai/types/admin/organization/projects/spend_alert_list_params.py">params</a>) -> <a href="./src/openai/types/admin/organization/projects/project_spend_alert.py">SyncConversationCursorPage[ProjectSpendAlert]</a></code>
- <code title="delete /organization/projects/{project_id}/spend_alerts/{alert_id}">client.admin.organization.projects.spend_alerts.<a href="./src/openai/resources/admin/organization/projects/spend_alerts.py">delete</a>(alert_id, \*, project_id) -> <a href="./src/openai/types/admin/organization/projects/project_spend_alert_deleted.py">ProjectSpendAlertDeleted</a></code>
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 = "2.41.1"
version = "2.42.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__ = "2.41.1" # x-release-please-version
__version__ = "2.42.0" # x-release-please-version
24 changes: 22 additions & 2 deletions src/openai/resources/admin/organization/admin_api_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def create(
self,
*,
name: str,
expires_in_seconds: int | Omit = omit,
# 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 All @@ -58,6 +59,9 @@ def create(
Create an organization admin API key

Args:
expires_in_seconds: The number of seconds until the API key expires. Omit this field for a key that
does not expire.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -68,7 +72,13 @@ def create(
"""
return self._post(
"/organization/admin_api_keys",
body=maybe_transform({"name": name}, admin_api_key_create_params.AdminAPIKeyCreateParams),
body=maybe_transform(
{
"name": name,
"expires_in_seconds": expires_in_seconds,
},
admin_api_key_create_params.AdminAPIKeyCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -234,6 +244,7 @@ async def create(
self,
*,
name: str,
expires_in_seconds: int | Omit = omit,
# 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 All @@ -245,6 +256,9 @@ async def create(
Create an organization admin API key

Args:
expires_in_seconds: The number of seconds until the API key expires. Omit this field for a key that
does not expire.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -255,7 +269,13 @@ async def create(
"""
return await self._post(
"/organization/admin_api_keys",
body=await async_maybe_transform({"name": name}, admin_api_key_create_params.AdminAPIKeyCreateParams),
body=await async_maybe_transform(
{
"name": name,
"expires_in_seconds": expires_in_seconds,
},
admin_api_key_create_params.AdminAPIKeyCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
24 changes: 22 additions & 2 deletions src/openai/resources/admin/organization/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ def list(
"role.deleted",
"role.assignment.created",
"role.assignment.deleted",
"role.bound_to_resource",
"role.unbound_from_resource",
"scim.enabled",
"scim.disabled",
"service_account.created",
Expand All @@ -116,6 +118,7 @@ def list(
limit: int | Omit = omit,
project_ids: SequenceNotStr[str] | Omit = omit,
resource_ids: SequenceNotStr[str] | Omit = omit,
tenant_only: bool | Omit = omit,
# 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 @@ -154,7 +157,13 @@ def list(
project_ids: Return only events for these projects.

resource_ids: Return only events performed on these targets. For example, a project ID
updated.
updated. For ChatGPT connector role events, use the workspace connector resource
ID shown in `details.id`, such as `<workspace_id>__<connector_id>`.

tenant_only: Return only tenant-scoped events associated with this organization. Required for
tenant-scoped events such as `role.bound_to_resource` and
`role.unbound_from_resource`. When `true`, all supplied event types must be
tenant-scoped.

extra_headers: Send extra headers

Expand Down Expand Up @@ -183,6 +192,7 @@ def list(
"limit": limit,
"project_ids": project_ids,
"resource_ids": resource_ids,
"tenant_only": tenant_only,
},
audit_log_list_params.AuditLogListParams,
),
Expand Down Expand Up @@ -273,6 +283,8 @@ def list(
"role.deleted",
"role.assignment.created",
"role.assignment.deleted",
"role.bound_to_resource",
"role.unbound_from_resource",
"scim.enabled",
"scim.disabled",
"service_account.created",
Expand All @@ -287,6 +299,7 @@ def list(
limit: int | Omit = omit,
project_ids: SequenceNotStr[str] | Omit = omit,
resource_ids: SequenceNotStr[str] | Omit = omit,
tenant_only: bool | Omit = omit,
# 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 @@ -325,7 +338,13 @@ def list(
project_ids: Return only events for these projects.

resource_ids: Return only events performed on these targets. For example, a project ID
updated.
updated. For ChatGPT connector role events, use the workspace connector resource
ID shown in `details.id`, such as `<workspace_id>__<connector_id>`.

tenant_only: Return only tenant-scoped events associated with this organization. Required for
tenant-scoped events such as `role.bound_to_resource` and
`role.unbound_from_resource`. When `true`, all supplied event types must be
tenant-scoped.

extra_headers: Send extra headers

Expand Down Expand Up @@ -354,6 +373,7 @@ def list(
"limit": limit,
"project_ids": project_ids,
"resource_ids": resource_ids,
"tenant_only": tenant_only,
},
audit_log_list_params.AuditLogListParams,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,48 @@ def create(
cast_to=ProjectSpendAlert,
)

def retrieve(
self,
alert_id: str,
*,
project_id: str,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ProjectSpendAlert:
"""
Retrieves a project spend alert.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
if not alert_id:
raise ValueError(f"Expected a non-empty value for `alert_id` but received {alert_id!r}")
return self._get(
path_template(
"/organization/projects/{project_id}/spend_alerts/{alert_id}", project_id=project_id, alert_id=alert_id
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=ProjectSpendAlert,
)

def update(
self,
alert_id: str,
Expand Down Expand Up @@ -349,6 +391,48 @@ async def create(
cast_to=ProjectSpendAlert,
)

async def retrieve(
self,
alert_id: str,
*,
project_id: str,
# 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ProjectSpendAlert:
"""
Retrieves a project spend alert.

Args:
extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not project_id:
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
if not alert_id:
raise ValueError(f"Expected a non-empty value for `alert_id` but received {alert_id!r}")
return await self._get(
path_template(
"/organization/projects/{project_id}/spend_alerts/{alert_id}", project_id=project_id, alert_id=alert_id
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
security={"admin_api_key_auth": True},
),
cast_to=ProjectSpendAlert,
)

async def update(
self,
alert_id: str,
Expand Down Expand Up @@ -524,6 +608,9 @@ def __init__(self, spend_alerts: SpendAlerts) -> None:
self.create = _legacy_response.to_raw_response_wrapper(
spend_alerts.create,
)
self.retrieve = _legacy_response.to_raw_response_wrapper(
spend_alerts.retrieve,
)
self.update = _legacy_response.to_raw_response_wrapper(
spend_alerts.update,
)
Expand All @@ -542,6 +629,9 @@ def __init__(self, spend_alerts: AsyncSpendAlerts) -> None:
self.create = _legacy_response.async_to_raw_response_wrapper(
spend_alerts.create,
)
self.retrieve = _legacy_response.async_to_raw_response_wrapper(
spend_alerts.retrieve,
)
self.update = _legacy_response.async_to_raw_response_wrapper(
spend_alerts.update,
)
Expand All @@ -560,6 +650,9 @@ def __init__(self, spend_alerts: SpendAlerts) -> None:
self.create = to_streamed_response_wrapper(
spend_alerts.create,
)
self.retrieve = to_streamed_response_wrapper(
spend_alerts.retrieve,
)
self.update = to_streamed_response_wrapper(
spend_alerts.update,
)
Expand All @@ -578,6 +671,9 @@ def __init__(self, spend_alerts: AsyncSpendAlerts) -> None:
self.create = async_to_streamed_response_wrapper(
spend_alerts.create,
)
self.retrieve = async_to_streamed_response_wrapper(
spend_alerts.retrieve,
)
self.update = async_to_streamed_response_wrapper(
spend_alerts.update,
)
Expand Down
Loading
Loading