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.0.1"
".": "6.1.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: 118
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-e205b1f2da6a1f2caa229efa9ede63f2d3d2fedeeb2dd6ed3d880bafdcb0ab88.yml
openapi_spec_hash: c8aee2469a749f6a838b40c57e4b7b06
config_hash: 45dcba51451ba532959c020a0ddbf23c
configured_endpoints: 122
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-fadefdc7c7e30df47c09df323669b242ff90ee08e51f304175ace5274e0aab49.yml
openapi_spec_hash: 6d20f639d9ff8a097a34962da6218231
config_hash: 902654e60f5d659f2bfcfd903e17c46d
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 6.1.0 (2025-10-02)

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

### Features

* **api:** add support for realtime calls ([5de9585](https://github.com/openai/openai-node/commit/5de958556679182dfbdce95b4db6b65ca742aa61))

## 6.0.1 (2025-10-01)

Full Changelog: [v6.0.0...v6.0.1](https://github.com/openai/openai-node/compare/v6.0.0...v6.0.1)
Expand Down
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ client.example.list(undefined, { headers: { ... } });
- `client.batches.list()`
- `client.responses.retrieve()`
- `client.responses.inputItems.list()`
- `client.realtime.calls.reject()`
- `client.conversations.create()`
- `client.conversations.items.list()`
- `client.evals.list()`
Expand Down
9 changes: 9 additions & 0 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,15 @@ Methods:

- <code title="post /realtime/client_secrets">client.realtime.clientSecrets.<a href="./src/resources/realtime/client-secrets.ts">create</a>({ ...params }) -> ClientSecretCreateResponse</code>

## Calls

Methods:

- <code title="post /realtime/calls/{call_id}/accept">client.realtime.calls.<a href="./src/resources/realtime/calls.ts">accept</a>(callID, { ...params }) -> void</code>
- <code title="post /realtime/calls/{call_id}/hangup">client.realtime.calls.<a href="./src/resources/realtime/calls.ts">hangup</a>(callID) -> void</code>
- <code title="post /realtime/calls/{call_id}/refer">client.realtime.calls.<a href="./src/resources/realtime/calls.ts">refer</a>(callID, { ...params }) -> void</code>
- <code title="post /realtime/calls/{call_id}/reject">client.realtime.calls.<a href="./src/resources/realtime/calls.ts">reject</a>(callID, { ...params }) -> void</code>

# Conversations

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.0.1",
"version": "6.1.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": "6.0.1",
"version": "6.1.0",
"description": "The official TypeScript library for the OpenAI API",
"author": "OpenAI <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions scripts/detect-breaking-changes
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TEST_PATHS=(
tests/api-resources/responses/input-items.test.ts
tests/api-resources/realtime/realtime.test.ts
tests/api-resources/realtime/client-secrets.test.ts
tests/api-resources/realtime/calls.test.ts
tests/api-resources/conversations/conversations.test.ts
tests/api-resources/conversations/items.test.ts
tests/api-resources/evals/evals.test.ts
Expand Down
204 changes: 204 additions & 0 deletions src/resources/realtime/calls.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

import { APIResource } from '../../core/resource';
import * as RealtimeAPI from './realtime';
import * as ResponsesAPI from '../responses/responses';
import { APIPromise } from '../../core/api-promise';
import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';

export class Calls extends APIResource {
/**
* Accept an incoming SIP call and configure the realtime session that will handle
* it.
*
* @example
* ```ts
* await client.realtime.calls.accept('call_id', {
* type: 'realtime',
* });
* ```
*/
accept(callID: string, body: CallAcceptParams, options?: RequestOptions): APIPromise<void> {
return this._client.post(path`/realtime/calls/${callID}/accept`, {
body,
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}

/**
* End an active Realtime API call, whether it was initiated over SIP or WebRTC.
*
* @example
* ```ts
* await client.realtime.calls.hangup('call_id');
* ```
*/
hangup(callID: string, options?: RequestOptions): APIPromise<void> {
return this._client.post(path`/realtime/calls/${callID}/hangup`, {
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}

/**
* Transfer an active SIP call to a new destination using the SIP REFER verb.
*
* @example
* ```ts
* await client.realtime.calls.refer('call_id', {
* target_uri: 'tel:+14155550123',
* });
* ```
*/
refer(callID: string, body: CallReferParams, options?: RequestOptions): APIPromise<void> {
return this._client.post(path`/realtime/calls/${callID}/refer`, {
body,
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}

/**
* Decline an incoming SIP call by returning a SIP status code to the caller.
*
* @example
* ```ts
* await client.realtime.calls.reject('call_id');
* ```
*/
reject(
callID: string,
body: CallRejectParams | null | undefined = {},
options?: RequestOptions,
): APIPromise<void> {
return this._client.post(path`/realtime/calls/${callID}/reject`, {
body,
...options,
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
});
}
}

export interface CallAcceptParams {
/**
* The type of session to create. Always `realtime` for the Realtime API.
*/
type: 'realtime';

/**
* Configuration for input and output audio.
*/
audio?: RealtimeAPI.RealtimeAudioConfig;

/**
* Additional fields to include in server outputs.
*
* `item.input_audio_transcription.logprobs`: Include logprobs for input audio
* transcription.
*/
include?: Array<'item.input_audio_transcription.logprobs'>;

/**
* The default system instructions (i.e. system message) prepended to model calls.
* This field allows the client to guide the model on desired responses. The model
* can be instructed on response content and format, (e.g. "be extremely succinct",
* "act friendly", "here are examples of good responses") and on audio behavior
* (e.g. "talk quickly", "inject emotion into your voice", "laugh frequently"). The
* instructions are not guaranteed to be followed by the model, but they provide
* guidance to the model on the desired behavior.
*
* Note that the server sets default instructions which will be used if this field
* is not set and are visible in the `session.created` event at the start of the
* session.
*/
instructions?: string;

/**
* Maximum number of output tokens for a single assistant response, inclusive of
* tool calls. Provide an integer between 1 and 4096 to limit output tokens, or
* `inf` for the maximum available tokens for a given model. Defaults to `inf`.
*/
max_output_tokens?: number | 'inf';

/**
* The Realtime model used for this session.
*/
model?:
| (string & {})
| 'gpt-realtime'
| 'gpt-realtime-2025-08-28'
| 'gpt-4o-realtime-preview'
| 'gpt-4o-realtime-preview-2024-10-01'
| 'gpt-4o-realtime-preview-2024-12-17'
| 'gpt-4o-realtime-preview-2025-06-03'
| 'gpt-4o-mini-realtime-preview'
| 'gpt-4o-mini-realtime-preview-2024-12-17';

/**
* The set of modalities the model can respond with. It defaults to `["audio"]`,
* indicating that the model will respond with audio plus a transcript. `["text"]`
* can be used to make the model respond with text only. It is not possible to
* request both `text` and `audio` at the same time.
*/
output_modalities?: Array<'text' | 'audio'>;

/**
* Reference to a prompt template and its variables.
* [Learn more](https://platform.openai.com/docs/guides/text?api-mode=responses#reusable-prompts).
*/
prompt?: ResponsesAPI.ResponsePrompt | null;

/**
* How the model chooses tools. Provide one of the string modes or force a specific
* function/MCP tool.
*/
tool_choice?: RealtimeAPI.RealtimeToolChoiceConfig;

/**
* Tools available to the model.
*/
tools?: RealtimeAPI.RealtimeToolsConfig;

/**
* Realtime API can write session traces to the
* [Traces Dashboard](/logs?api=traces). Set to null to disable tracing. Once
* tracing is enabled for a session, the configuration cannot be modified.
*
* `auto` will create a trace for the session with default values for the workflow
* name, group id, and metadata.
*/
tracing?: RealtimeAPI.RealtimeTracingConfig | null;

/**
* Controls how the realtime conversation is truncated prior to model inference.
* The default is `auto`.
*/
truncation?: RealtimeAPI.RealtimeTruncation;
}

export interface CallReferParams {
/**
* URI that should appear in the SIP Refer-To header. Supports values like
* `tel:+14155550123` or `sip:[email protected]`.
*/
target_uri: string;
}

export interface CallRejectParams {
/**
* SIP response code to send back to the caller. Defaults to `603` (Decline) when
* omitted.
*/
status_code?: number;
}

export declare namespace Calls {
export {
type CallAcceptParams as CallAcceptParams,
type CallReferParams as CallReferParams,
type CallRejectParams as CallRejectParams,
};
}
6 changes: 6 additions & 0 deletions src/resources/realtime/client-secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import { RequestOptions } from '../../internal/request-options';
export class ClientSecrets extends APIResource {
/**
* Create a Realtime client secret with an associated session configuration.
*
* @example
* ```ts
* const clientSecret =
* await client.realtime.clientSecrets.create();
* ```
*/
create(body: ClientSecretCreateParams, options?: RequestOptions): APIPromise<ClientSecretCreateResponse> {
return this._client.post('/realtime/client_secrets', { body, ...options });
Expand Down
1 change: 1 addition & 0 deletions src/resources/realtime/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

export { Calls, type CallAcceptParams, type CallReferParams, type CallRejectParams } from './calls';
export {
ClientSecrets,
type RealtimeSessionClientSecret,
Expand Down
11 changes: 11 additions & 0 deletions src/resources/realtime/realtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import { APIResource } from '../../core/resource';
import * as RealtimeAPI from './realtime';
import * as Shared from '../shared';
import * as CallsAPI from './calls';
import { CallAcceptParams, CallReferParams, CallRejectParams, Calls } from './calls';
import * as ClientSecretsAPI from './client-secrets';
import {
ClientSecretCreateParams,
Expand All @@ -17,6 +19,7 @@ import * as ResponsesAPI from '../responses/responses';

export class Realtime extends APIResource {
clientSecrets: ClientSecretsAPI.ClientSecrets = new ClientSecretsAPI.ClientSecrets(this._client);
calls: CallsAPI.Calls = new CallsAPI.Calls(this._client);
}

export interface AudioTranscription {
Expand Down Expand Up @@ -4580,6 +4583,7 @@ export namespace TranscriptionSessionUpdatedEvent {
}

Realtime.ClientSecrets = ClientSecrets;
Realtime.Calls = Calls;

export declare namespace Realtime {
export {
Expand Down Expand Up @@ -4694,4 +4698,11 @@ export declare namespace Realtime {
type ClientSecretCreateResponse as ClientSecretCreateResponse,
type ClientSecretCreateParams as ClientSecretCreateParams,
};

export {
Calls as Calls,
type CallAcceptParams as CallAcceptParams,
type CallReferParams as CallReferParams,
type CallRejectParams as CallRejectParams,
};
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '6.0.1'; // x-release-please-version
export const VERSION = '6.1.0'; // x-release-please-version
Loading