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 @@
{
".": "6.48.0"
".": "6.49.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: 271
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-8ed7dcb0d163e7f5205dbe172d6ad5b7ce367b23c20629830e39a0aee920a029.yml
openapi_spec_hash: 011cdae0c67909fb80a4a5eb54ca5bca
config_hash: 896f0f71bc7d1ee09435813cdef97523
configured_endpoints: 277
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai/openai-0650ebae454b4200491980d7663cb7ceabcff90dcb3ed9f67c3bca3e861a2bf6.yml
openapi_spec_hash: e9576bced964246b7e685a5ad30afffa
config_hash: 43e311595bcc4fb6b32eba0684de48d8
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# Changelog

## 6.49.0 (2026-07-23)

Full Changelog: [v6.48.0...v6.49.0](https://github.com/openai/openai-node/compare/v6.48.0...v6.49.0)

### Features

* **api:** accept `None` for prompt_cache_key/safety_identifier ([c54a7f3](https://github.com/openai/openai-node/commit/c54a7f3b01760b705ebca1e88738fb649187ffe0))
* **api:** add support for `spend_limit` admin apis ([e8238b0](https://github.com/openai/openai-node/commit/e8238b085de715dbf0c0cb64e7e6207314b12954))
* **helpers:** add standard schema support ([#1997](https://github.com/openai/openai-node/issues/1997)) ([4ced1a8](https://github.com/openai/openai-node/commit/4ced1a8eaba3f5e960b94090a75e8048f7642439))
* **helpers:** add zod realtime function helper ([#1996](https://github.com/openai/openai-node/issues/1996)) ([ee59911](https://github.com/openai/openai-node/commit/ee59911804fa56e1bcac01a127108b63a7cd28e5))
* **stlc:** configurable CI runner and private-production-repo support in workflow templates ([967a66b](https://github.com/openai/openai-node/commit/967a66b2349c5ce5d45fbe902287f121d6b3cf64))
* **zod:** support schema definitions ([#1993](https://github.com/openai/openai-node/issues/1993)) ([eb04567](https://github.com/openai/openai-node/commit/eb04567313c6296b80fc3c47306ee96b9c34456f))


### Bug Fixes

* address code scanning findings ([#2007](https://github.com/openai/openai-node/issues/2007)) ([2706888](https://github.com/openai/openai-node/commit/2706888499a777b47d851aeb479f846f80932765))
* address remaining Dependabot alerts ([#2005](https://github.com/openai/openai-node/issues/2005)) ([6ab3428](https://github.com/openai/openai-node/commit/6ab34285f02d6e9fb4eb1779fca13e51d1be3e10))
* **azure:** normalize endpoint trailing slashes ([#1995](https://github.com/openai/openai-node/issues/1995)) ([39a15b4](https://github.com/openai/openai-node/commit/39a15b412fc129df15339ebd6e3e6547854aa81f))
* **ci:** restore explicit TypeScript SDK runner selection ([fe79401](https://github.com/openai/openai-node/commit/fe79401763f192a2705204c7235c21b036fdb238))
* **runTools:** sanitize replayed messages ([#1990](https://github.com/openai/openai-node/issues/1990)) ([a60cc25](https://github.com/openai/openai-node/commit/a60cc250d4c442bae25e05c67c6bd30d18fc87e6))
* **stream:** handle audio completion markers ([#1991](https://github.com/openai/openai-node/issues/1991)) ([bd86817](https://github.com/openai/openai-node/commit/bd86817ea0c9ebe233f30d80c9b98b80a8b30be1))
* **zod:** escape schema definition refs before strict validation ([bff2b10](https://github.com/openai/openai-node/commit/bff2b104f53fde6d620327790a8a5cb6dfd5ff0c))
* **zod:** infer parsed tool callback arguments ([#1992](https://github.com/openai/openai-node/issues/1992)) ([83cdb79](https://github.com/openai/openai-node/commit/83cdb79e62c24dbf0cd27d893c8b792dadf6bcf8))
* **zod:** preserve schema types while escaping refs ([cb7e195](https://github.com/openai/openai-node/commit/cb7e19539160d71b381a7e2ff6c98fe4981c52eb))


### Chores

* exclude Brewfile from language detection ([#2006](https://github.com/openai/openai-node/issues/2006)) ([9bec333](https://github.com/openai/openai-node/commit/9bec3332133c115b0e728010ab614daf5516e35b))
* refresh more ecosystem test dependencies ([#2003](https://github.com/openai/openai-node/issues/2003)) ([3cafa55](https://github.com/openai/openai-node/commit/3cafa553aeb7f10e9afb432ae5d4aaa1c6d42663))

## 6.48.0 (2026-07-17)

Full Changelog: [v6.47.0...v6.48.0](https://github.com/openai/openai-node/compare/v6.47.0...v6.48.0)
Expand Down
26 changes: 26 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,19 @@ Methods:
- <code title="get /organization/data_retention">client.admin.organization.dataRetention.<a href="./src/resources/admin/organization/data-retention.ts">retrieve</a>() -> OrganizationDataRetention</code>
- <code title="post /organization/data_retention">client.admin.organization.dataRetention.<a href="./src/resources/admin/organization/data-retention.ts">update</a>({ ...params }) -> OrganizationDataRetention</code>

### SpendLimit

Types:

- <code><a href="./src/resources/admin/organization/spend-limit.ts">OrganizationSpendLimit</a></code>
- <code><a href="./src/resources/admin/organization/spend-limit.ts">OrganizationSpendLimitDeleted</a></code>

Methods:

- <code title="get /organization/spend_limit">client.admin.organization.spendLimit.<a href="./src/resources/admin/organization/spend-limit.ts">retrieve</a>() -> OrganizationSpendLimit</code>
- <code title="post /organization/spend_limit">client.admin.organization.spendLimit.<a href="./src/resources/admin/organization/spend-limit.ts">update</a>({ ...params }) -> OrganizationSpendLimit</code>
- <code title="delete /organization/spend_limit">client.admin.organization.spendLimit.<a href="./src/resources/admin/organization/spend-limit.ts">delete</a>() -> OrganizationSpendLimitDeleted</code>

### SpendAlerts

Types:
Expand Down Expand Up @@ -1165,6 +1178,19 @@ Methods:
- <code title="get /organization/projects/{project_id}/data_retention">client.admin.organization.projects.dataRetention.<a href="./src/resources/admin/organization/projects/data-retention.ts">retrieve</a>(projectID) -> ProjectDataRetention</code>
- <code title="post /organization/projects/{project_id}/data_retention">client.admin.organization.projects.dataRetention.<a href="./src/resources/admin/organization/projects/data-retention.ts">update</a>(projectID, { ...params }) -> ProjectDataRetention</code>

#### SpendLimit

Types:

- <code><a href="./src/resources/admin/organization/projects/spend-limit.ts">ProjectSpendLimit</a></code>
- <code><a href="./src/resources/admin/organization/projects/spend-limit.ts">ProjectSpendLimitDeleted</a></code>

Methods:

- <code title="get /organization/projects/{project_id}/spend_limit">client.admin.organization.projects.spendLimit.<a href="./src/resources/admin/organization/projects/spend-limit.ts">retrieve</a>(projectID) -> ProjectSpendLimit</code>
- <code title="post /organization/projects/{project_id}/spend_limit">client.admin.organization.projects.spendLimit.<a href="./src/resources/admin/organization/projects/spend-limit.ts">update</a>(projectID, { ...params }) -> ProjectSpendLimit</code>
- <code title="delete /organization/projects/{project_id}/spend_limit">client.admin.organization.projects.spendLimit.<a href="./src/resources/admin/organization/projects/spend-limit.ts">delete</a>(projectID) -> ProjectSpendLimitDeleted</code>

#### SpendAlerts

Types:
Expand Down
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openai/openai",
"version": "6.48.0",
"version": "6.49.0",
"exports": {
".": "./index.ts",
"./providers/bedrock": "./providers/bedrock.ts",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "openai",
"version": "6.48.0",
"version": "6.49.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <support@openai.com>",
"types": "dist/index.d.ts",
Expand Down
2 changes: 2 additions & 0 deletions scripts/detect-breaking-changes
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ TEST_PATHS=(
tests/api-resources/admin/organization/groups/roles.test.ts
tests/api-resources/admin/organization/roles.test.ts
tests/api-resources/admin/organization/data-retention.test.ts
tests/api-resources/admin/organization/spend-limit.test.ts
tests/api-resources/admin/organization/spend-alerts.test.ts
tests/api-resources/admin/organization/certificates.test.ts
tests/api-resources/admin/organization/projects/projects.test.ts
Expand All @@ -73,6 +74,7 @@ TEST_PATHS=(
tests/api-resources/admin/organization/projects/groups/roles.test.ts
tests/api-resources/admin/organization/projects/roles.test.ts
tests/api-resources/admin/organization/projects/data-retention.test.ts
tests/api-resources/admin/organization/projects/spend-limit.test.ts
tests/api-resources/admin/organization/projects/spend-alerts.test.ts
tests/api-resources/admin/organization/projects/certificates.test.ts
tests/api-resources/responses/responses.test.ts
Expand Down
50 changes: 25 additions & 25 deletions src/helpers/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ function validateSchemaDefinitions(schemaDefinitions: ZodSchemaDefinitions | und
}
}

function escapeSchemaDefinitionRefs(
schema: Record<string, unknown>,
function escapeSchemaDefinitionRefs<T extends object>(
schema: T,
schemaDefinitions: ZodSchemaDefinitions | undefined,
): Record<string, unknown> {
): T {
const refReplacements = new Map(
Object.keys(schemaDefinitions ?? {}).map((name) => [
`#/definitions/${name}`,
Expand Down Expand Up @@ -126,30 +126,30 @@ function zodV4ToJsonSchema(
metadata?.add(definition as unknown as z4.ZodType, { id: name });
}

const jsonSchema = toStrictJsonSchema(
z4.toJSONSchema(schema, {
target: 'draft-7',
...(metadata ? { metadata } : undefined),
override: ({ zodSchema, jsonSchema }) => {
const def = zodSchema._zod.def;

if (def.type === 'union' && 'discriminator' in def && Array.isArray(jsonSchema.oneOf)) {
if (jsonSchema.anyOf !== undefined) {
throw new Error(
'Zod discriminated union generated both `anyOf` and `oneOf`, which cannot be represented in an OpenAI strict schema',
);
}

// Discriminator values are mutually exclusive, so anyOf preserves the
// union while staying inside the API's supported JSON Schema subset.
jsonSchema.anyOf = jsonSchema.oneOf;
delete jsonSchema.oneOf;
const jsonSchema = z4.toJSONSchema(schema, {
target: 'draft-7',
...(metadata ? { metadata } : undefined),
override: ({ zodSchema, jsonSchema }) => {
const def = zodSchema._zod.def;

if (def.type === 'union' && 'discriminator' in def && Array.isArray(jsonSchema.oneOf)) {
if (jsonSchema.anyOf !== undefined) {
throw new Error(
'Zod discriminated union generated both `anyOf` and `oneOf`, which cannot be represented in an OpenAI strict schema',
);
}
},
}) as JSONSchema,
) as Record<string, unknown>;

return escapeSchemaDefinitionRefs(jsonSchema, options.schemaDefinitions);
// Discriminator values are mutually exclusive, so anyOf preserves the
// union while staying inside the API's supported JSON Schema subset.
jsonSchema.anyOf = jsonSchema.oneOf;
delete jsonSchema.oneOf;
}
},
}) as JSONSchema;

const escapedSchema = escapeSchemaDefinitionRefs(jsonSchema, options.schemaDefinitions);

return toStrictJsonSchema(escapedSchema) as Record<string, unknown>;
}

function zodV3ToNonStrictJsonSchema(schema: z3.ZodType, options: { name: string }): Record<string, unknown> {
Expand Down
6 changes: 6 additions & 0 deletions src/resources/admin/organization/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ export {
type SpendAlertListParams,
type OrganizationSpendAlertsPage,
} from './spend-alerts';
export {
SpendLimit,
type OrganizationSpendLimit,
type OrganizationSpendLimitDeleted,
type SpendLimitUpdateParams,
} from './spend-limit';
export {
Usage,
type UsageAudioSpeechesResponse,
Expand Down
16 changes: 16 additions & 0 deletions src/resources/admin/organization/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ import {
SpendAlertUpdateParams,
SpendAlerts,
} from './spend-alerts';
import * as SpendLimitAPI from './spend-limit';
import {
OrganizationSpendLimit,
OrganizationSpendLimitDeleted,
SpendLimit,
SpendLimitUpdateParams,
} from './spend-limit';
import * as UsageAPI from './usage';
import {
Usage,
Expand Down Expand Up @@ -127,6 +134,7 @@ export class Organization extends APIResource {
groups: GroupsAPI.Groups = new GroupsAPI.Groups(this._client);
roles: RolesAPI.Roles = new RolesAPI.Roles(this._client);
dataRetention: DataRetentionAPI.DataRetention = new DataRetentionAPI.DataRetention(this._client);
spendLimit: SpendLimitAPI.SpendLimit = new SpendLimitAPI.SpendLimit(this._client);
spendAlerts: SpendAlertsAPI.SpendAlerts = new SpendAlertsAPI.SpendAlerts(this._client);
certificates: CertificatesAPI.Certificates = new CertificatesAPI.Certificates(this._client);
projects: ProjectsAPI.Projects = new ProjectsAPI.Projects(this._client);
Expand All @@ -140,6 +148,7 @@ Organization.Users = Users;
Organization.Groups = Groups;
Organization.Roles = Roles;
Organization.DataRetention = DataRetention;
Organization.SpendLimit = SpendLimit;
Organization.SpendAlerts = SpendAlerts;
Organization.Certificates = Certificates;
Organization.Projects = Projects;
Expand Down Expand Up @@ -233,6 +242,13 @@ export declare namespace Organization {
type DataRetentionUpdateParams as DataRetentionUpdateParams,
};

export {
SpendLimit as SpendLimit,
type OrganizationSpendLimit as OrganizationSpendLimit,
type OrganizationSpendLimitDeleted as OrganizationSpendLimitDeleted,
type SpendLimitUpdateParams as SpendLimitUpdateParams,
};

export {
SpendAlerts as SpendAlerts,
type OrganizationSpendAlert as OrganizationSpendAlert,
Expand Down
6 changes: 6 additions & 0 deletions src/resources/admin/organization/projects/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ export {
type SpendAlertDeleteParams,
type ProjectSpendAlertsPage,
} from './spend-alerts';
export {
SpendLimit,
type ProjectSpendLimit,
type ProjectSpendLimitDeleted,
type SpendLimitUpdateParams,
} from './spend-limit';
export {
Users,
type ProjectUser,
Expand Down
16 changes: 16 additions & 0 deletions src/resources/admin/organization/projects/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ import {
SpendAlertUpdateParams,
SpendAlerts,
} from './spend-alerts';
import * as SpendLimitAPI from './spend-limit';
import {
ProjectSpendLimit,
ProjectSpendLimitDeleted,
SpendLimit,
SpendLimitUpdateParams,
} from './spend-limit';
import * as GroupsAPI from './groups/groups';
import {
GroupCreateParams,
Expand Down Expand Up @@ -127,6 +134,7 @@ export class Projects extends APIResource {
groups: GroupsAPI.Groups = new GroupsAPI.Groups(this._client);
roles: RolesAPI.Roles = new RolesAPI.Roles(this._client);
dataRetention: DataRetentionAPI.DataRetention = new DataRetentionAPI.DataRetention(this._client);
spendLimit: SpendLimitAPI.SpendLimit = new SpendLimitAPI.SpendLimit(this._client);
spendAlerts: SpendAlertsAPI.SpendAlerts = new SpendAlertsAPI.SpendAlerts(this._client);
certificates: CertificatesAPI.Certificates = new CertificatesAPI.Certificates(this._client);

Expand Down Expand Up @@ -325,6 +333,7 @@ Projects.HostedToolPermissions = HostedToolPermissions;
Projects.Groups = Groups;
Projects.Roles = Roles;
Projects.DataRetention = DataRetention;
Projects.SpendLimit = SpendLimit;
Projects.SpendAlerts = SpendAlerts;
Projects.Certificates = Certificates;

Expand Down Expand Up @@ -420,6 +429,13 @@ export declare namespace Projects {
type DataRetentionUpdateParams as DataRetentionUpdateParams,
};

export {
SpendLimit as SpendLimit,
type ProjectSpendLimit as ProjectSpendLimit,
type ProjectSpendLimitDeleted as ProjectSpendLimitDeleted,
type SpendLimitUpdateParams as SpendLimitUpdateParams,
};

export {
SpendAlerts as SpendAlerts,
type ProjectSpendAlert as ProjectSpendAlert,
Expand Down
Loading
Loading