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 @@
{
".": "5.6.0"
".": "5.7.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

## 5.7.0 (2025-06-23)

Full Changelog: [v5.6.0...v5.7.0](https://github.com/openai/openai-node/compare/v5.6.0...v5.7.0)

### Features

* **api:** update api shapes for usage and code interpreter ([f2100e8](https://github.com/openai/openai-node/commit/f2100e89334753e7f580f7f20f48b43eb8ba2fe3))

## 5.6.0 (2025-06-20)

Full Changelog: [v5.5.1...v5.6.0](https://github.com/openai/openai-node/compare/v5.5.1...v5.6.0)
Expand Down
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Types:
Methods:

- <code title="post /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fineTuning.checkpoints.permissions.<a href="./src/resources/fine-tuning/checkpoints/permissions.ts">create</a>(fineTunedModelCheckpoint, { ...params }) -> PermissionCreateResponsesPage</code>
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fineTuning.checkpoints.permissions.<a href="./src/resources/fine-tuning/checkpoints/permissions.ts">retrieve</a>(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponsesPage</code>
- <code title="get /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions">client.fineTuning.checkpoints.permissions.<a href="./src/resources/fine-tuning/checkpoints/permissions.ts">retrieve</a>(fineTunedModelCheckpoint, { ...params }) -> PermissionRetrieveResponse</code>
- <code title="delete /fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}">client.fineTuning.checkpoints.permissions.<a href="./src/resources/fine-tuning/checkpoints/permissions.ts">delete</a>(permissionID, { ...params }) -> PermissionDeleteResponse</code>

## Alpha
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": "5.6.0",
"version": "5.7.0",
"exports": {
".": "./index.ts",
"./helpers/zod": "./helpers/zod.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": "5.6.0",
"version": "5.7.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
8 changes: 7 additions & 1 deletion src/resources/audio/speech.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,15 @@ export interface SpeechCreateParams {

/**
* 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.
*/
speed?: number;

/**
* The format to stream the audio in. Supported formats are `sse` and `audio`.
* `sse` is not supported for `tts-1` or `tts-1-hd`.
*/
stream_format?: 'sse' | 'audio';
}

export declare namespace Speech {
Expand Down
141 changes: 141 additions & 0 deletions src/resources/audio/transcriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export interface Transcription {
* to the `include` array.
*/
logprobs?: Array<Transcription.Logprob>;

/**
* Token usage statistics for the request.
*/
usage?: Transcription.Tokens | Transcription.Duration;
}

export namespace Transcription {
Expand All @@ -97,6 +102,68 @@ export namespace Transcription {
*/
logprob?: number;
}

/**
* Usage statistics for models billed by token usage.
*/
export interface Tokens {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;

/**
* Number of output tokens generated.
*/
output_tokens: number;

/**
* Total number of tokens used (input + output).
*/
total_tokens: number;

/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';

/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Tokens.InputTokenDetails;
}

export namespace Tokens {
/**
* Details about the input tokens billed for this request.
*/
export interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;

/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}

/**
* Usage statistics for models billed by audio input duration.
*/
export interface Duration {
/**
* Duration of the input audio in seconds.
*/
duration: number;

/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}

export type TranscriptionInclude = 'logprobs';
Expand Down Expand Up @@ -232,6 +299,11 @@ export interface TranscriptionTextDoneEvent {
* with the `include[]` parameter set to `logprobs`.
*/
logprobs?: Array<TranscriptionTextDoneEvent.Logprob>;

/**
* Usage statistics for models billed by token usage.
*/
usage?: TranscriptionTextDoneEvent.Usage;
}

export namespace TranscriptionTextDoneEvent {
Expand All @@ -251,6 +323,53 @@ export namespace TranscriptionTextDoneEvent {
*/
logprob?: number;
}

/**
* Usage statistics for models billed by token usage.
*/
export interface Usage {
/**
* Number of input tokens billed for this request.
*/
input_tokens: number;

/**
* Number of output tokens generated.
*/
output_tokens: number;

/**
* Total number of tokens used (input + output).
*/
total_tokens: number;

/**
* The type of the usage object. Always `tokens` for this variant.
*/
type: 'tokens';

/**
* Details about the input tokens billed for this request.
*/
input_token_details?: Usage.InputTokenDetails;
}

export namespace Usage {
/**
* Details about the input tokens billed for this request.
*/
export interface InputTokenDetails {
/**
* Number of audio tokens billed for this request.
*/
audio_tokens?: number;

/**
* Number of text tokens billed for this request.
*/
text_tokens?: number;
}
}
}

/**
Expand Down Expand Up @@ -278,12 +397,34 @@ export interface TranscriptionVerbose {
*/
segments?: Array<TranscriptionSegment>;

/**
* Usage statistics for models billed by audio input duration.
*/
usage?: TranscriptionVerbose.Usage;

/**
* Extracted words and their corresponding timestamps.
*/
words?: Array<TranscriptionWord>;
}

export namespace TranscriptionVerbose {
/**
* Usage statistics for models billed by audio input duration.
*/
export interface Usage {
/**
* Duration of the input audio in seconds.
*/
duration: number;

/**
* The type of the usage object. Always `duration` for this variant.
*/
type: 'duration';
}
}

export interface TranscriptionWord {
/**
* End time of the word in seconds.
Expand Down
12 changes: 6 additions & 6 deletions src/resources/beta/realtime/realtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ export interface ConversationItemDeletedEvent {
* the Response events.
*
* Realtime API models accept audio natively, and thus input transcription is a
* separate process run on a separate ASR (Automatic Speech Recognition) model,
* currently always `whisper-1`. Thus the transcript may diverge somewhat from the
* model's interpretation, and should be treated as a rough guide.
* separate process run on a separate ASR (Automatic Speech Recognition) model. The
* transcript may diverge somewhat from the model's interpretation, and should be
* treated as a rough guide.
*/
export interface ConversationItemInputAudioTranscriptionCompletedEvent {
/**
Expand Down Expand Up @@ -2248,19 +2248,19 @@ export namespace SessionUpdateEvent {
/**
* Configuration for the ephemeral token expiration.
*/
expires_at?: ClientSecret.ExpiresAt;
expires_after?: ClientSecret.ExpiresAfter;
}

export namespace ClientSecret {
/**
* Configuration for the ephemeral token expiration.
*/
export interface ExpiresAt {
export interface ExpiresAfter {
/**
* The anchor point for the ephemeral token expiration. Only `created_at` is
* currently supported.
*/
anchor?: 'created_at';
anchor: 'created_at';

/**
* The number of seconds from the anchor point to the expiration. Select a value
Expand Down
17 changes: 8 additions & 9 deletions src/resources/beta/realtime/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ export interface SessionCreateResponse {
* Configuration for input audio transcription, defaults to off and can be set to
* `null` to turn off once on. Input audio transcription is not native to the
* model, since the model consumes audio directly. Transcription runs
* asynchronously through Whisper and should be treated as rough guidance rather
* than the representation understood by the model.
* asynchronously and should be treated as rough guidance rather than the
* representation understood by the model.
*/
input_audio_transcription?: SessionCreateResponse.InputAudioTranscription;

Expand Down Expand Up @@ -476,13 +476,12 @@ export namespace SessionCreateResponse {
* Configuration for input audio transcription, defaults to off and can be set to
* `null` to turn off once on. Input audio transcription is not native to the
* model, since the model consumes audio directly. Transcription runs
* asynchronously through Whisper and should be treated as rough guidance rather
* than the representation understood by the model.
* asynchronously and should be treated as rough guidance rather than the
* representation understood by the model.
*/
export interface InputAudioTranscription {
/**
* The model to use for transcription, `whisper-1` is the only currently supported
* model.
* The model to use for transcription.
*/
model?: string;
}
Expand Down Expand Up @@ -721,19 +720,19 @@ export namespace SessionCreateParams {
/**
* Configuration for the ephemeral token expiration.
*/
expires_at?: ClientSecret.ExpiresAt;
expires_after?: ClientSecret.ExpiresAfter;
}

export namespace ClientSecret {
/**
* Configuration for the ephemeral token expiration.
*/
export interface ExpiresAt {
export interface ExpiresAfter {
/**
* The anchor point for the ephemeral token expiration. Only `created_at` is
* currently supported.
*/
anchor?: 'created_at';
anchor: 'created_at';

/**
* The number of seconds from the anchor point to the expiration. Select a value
Expand Down
2 changes: 0 additions & 2 deletions src/resources/fine-tuning/checkpoints/checkpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
PermissionDeleteResponse,
PermissionRetrieveParams,
PermissionRetrieveResponse,
PermissionRetrieveResponsesPage,
Permissions,
} from './permissions';

Expand All @@ -27,7 +26,6 @@ export declare namespace Checkpoints {
type PermissionRetrieveResponse as PermissionRetrieveResponse,
type PermissionDeleteResponse as PermissionDeleteResponse,
type PermissionCreateResponsesPage as PermissionCreateResponsesPage,
type PermissionRetrieveResponsesPage as PermissionRetrieveResponsesPage,
type PermissionCreateParams as PermissionCreateParams,
type PermissionRetrieveParams as PermissionRetrieveParams,
type PermissionDeleteParams as PermissionDeleteParams,
Expand Down
1 change: 0 additions & 1 deletion src/resources/fine-tuning/checkpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ export {
type PermissionRetrieveParams,
type PermissionDeleteParams,
type PermissionCreateResponsesPage,
type PermissionRetrieveResponsesPage,
} from './permissions';
Loading