diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml index 6ee625c09..9b3d78700 100644 --- a/.github/workflows/create-releases.yml +++ b/.github/workflows/create-releases.yml @@ -47,4 +47,3 @@ jobs: if: ${{ steps.release.outputs.releases_created }} run: | bash ./bin/publish-jsr - diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 37bc09e80..3bb1d714f 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -21,4 +21,3 @@ jobs: env: STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} - diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 8ace91523..e1e352c16 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "6.1.0" + ".": "6.2.0" } diff --git a/.stats.yml b/.stats.yml index 4e40d470f..f7aa916fc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -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 +configured_endpoints: 135 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-d64cf80d2ebddf175c5578f68226a3d5bbd3f7fd8d62ccac2205f3fc05a355ee.yml +openapi_spec_hash: d51e0d60d0c536f210b597a211bc5af0 +config_hash: e7c42016df9c6bd7bd6ff15101b9bc9b diff --git a/CHANGELOG.md b/CHANGELOG.md index c9e656df0..4037b61cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 6.2.0 (2025-10-06) + +Full Changelog: [v6.1.0...v6.2.0](https://github.com/openai/openai-node/compare/v6.1.0...v6.2.0) + +### Features + +* **api:** dev day 2025 launches ([f2816db](https://github.com/openai/openai-node/commit/f2816dbc6ae162d39017e7bafb0d23d0b51dd585)) + + +### Chores + +* **internal:** codegen related update ([b6f64b7](https://github.com/openai/openai-node/commit/b6f64b70ea681b174695d930f957aa49194553ed)) +* **jsdoc:** fix [@link](https://github.com/link) annotations to refer only to parts of the packageā€˜s public interface ([73e465d](https://github.com/openai/openai-node/commit/73e465d382a45389ab47a0a92575e4415e8d3276)) + ## 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) diff --git a/MIGRATION.md b/MIGRATION.md index 96f665c17..bfe394cb9 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -126,6 +126,8 @@ client.example.list(undefined, { headers: { ... } }); - `client.fineTuning.checkpoints.permissions.retrieve()` - `client.vectorStores.list()` - `client.vectorStores.files.list()` +- `client.beta.chatkit.threads.list()` +- `client.beta.chatkit.threads.listItems()` - `client.beta.assistants.list()` - `client.beta.threads.create()` - `client.beta.threads.runs.list()` @@ -140,6 +142,8 @@ client.example.list(undefined, { headers: { ... } }); - `client.evals.runs.list()` - `client.containers.list()` - `client.containers.files.list()` +- `client.videos.list()` +- `client.videos.downloadContent()` ### HTTP method naming diff --git a/api.md b/api.md index b6e346562..17b9d6797 100644 --- a/api.md +++ b/api.md @@ -469,6 +469,56 @@ Types: Methods: - client.beta.realtime.transcriptionSessions.create({ ...params }) -> TranscriptionSession +## ChatKit + +Types: + +- ChatKitWorkflow +- FilePart +- ImagePart +- ChatKitUploadFileResponse + +Methods: + +- client.beta.chatkit.uploadFile({ ...params }) -> ChatKitUploadFileResponse + +### Sessions + +Methods: + +- client.beta.chatkit.sessions.create({ ...params }) -> ChatSession +- client.beta.chatkit.sessions.cancel(sessionID) -> ChatSession + +### Threads + +Types: + +- ChatSession +- ChatSessionAutomaticThreadTitling +- ChatSessionChatKitConfiguration +- ChatSessionChatKitConfigurationParam +- ChatSessionExpiresAfterParam +- ChatSessionFileUpload +- ChatSessionHistory +- ChatSessionRateLimits +- ChatSessionRateLimitsParam +- ChatSessionStatus +- ChatSessionWorkflowParam +- ChatKitAttachment +- ChatKitResponseOutputText +- ChatKitThread +- ChatKitThreadAssistantMessageItem +- ChatKitThreadItemList +- ChatKitThreadUserMessageItem +- ChatKitWidgetItem +- ThreadDeleteResponse + +Methods: + +- client.beta.chatkit.threads.retrieve(threadID) -> ChatKitThread +- client.beta.chatkit.threads.list({ ...params }) -> ChatKitThreadsPage +- client.beta.chatkit.threads.delete(threadID) -> ThreadDeleteResponse +- client.beta.chatkit.threads.listItems(threadID, { ...params }) -> ChatKitThreadItemListDataPage ## Assistants @@ -1032,3 +1082,23 @@ Methods: Methods: - client.containers.files.content.retrieve(fileID, { ...params }) -> Response + +# Videos + +Types: + +- Video +- VideoCreateError +- VideoModel +- VideoSeconds +- VideoSize +- VideoDeleteResponse + +Methods: + +- client.videos.create({ ...params }) -> Video +- client.videos.retrieve(videoID) -> Video +- client.videos.list({ ...params }) -> VideosPage +- client.videos.delete(videoID) -> VideoDeleteResponse +- client.videos.downloadContent(videoID, { ...params }) -> Response +- client.videos.remix(videoID, { ...params }) -> Video diff --git a/bin/cli b/bin/cli index b030d2aeb..0bbffe6ba 100755 --- a/bin/cli +++ b/bin/cli @@ -20,9 +20,9 @@ const commands = { if (result.status !== 0) { process.exit(result.status); } - } - } -} + }, + }, +}; function exitWithHelp() { console.log(`Usage: openai `); diff --git a/jsr.json b/jsr.json index a7819c2ba..d341a779f 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@openai/openai", - "version": "6.1.0", + "version": "6.2.0", "exports": { ".": "./index.ts", "./helpers/zod": "./helpers/zod.ts", diff --git a/package.json b/package.json index fc7599145..fdfd35192 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openai", - "version": "6.1.0", + "version": "6.2.0", "description": "The official TypeScript library for the OpenAI API", "author": "OpenAI ", "types": "dist/index.d.ts", diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 4f79a5486..dceced270 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -34,6 +34,9 @@ TEST_PATHS=( tests/api-resources/beta/realtime/realtime.test.ts tests/api-resources/beta/realtime/sessions.test.ts tests/api-resources/beta/realtime/transcription-sessions.test.ts + tests/api-resources/beta/chatkit/chatkit.test.ts + tests/api-resources/beta/chatkit/sessions.test.ts + tests/api-resources/beta/chatkit/threads.test.ts tests/api-resources/beta/assistants.test.ts tests/api-resources/beta/threads/threads.test.ts tests/api-resources/beta/threads/runs/runs.test.ts @@ -55,6 +58,7 @@ TEST_PATHS=( tests/api-resources/containers/containers.test.ts tests/api-resources/containers/files/files.test.ts tests/api-resources/containers/files/content.test.ts + tests/api-resources/videos.test.ts tests/index.test.ts ) diff --git a/src/client.ts b/src/client.ts index d77a85ba4..966fdd499 100644 --- a/src/client.ts +++ b/src/client.ts @@ -92,6 +92,20 @@ import { ModerationTextInput, Moderations, } from './resources/moderations'; +import { + Video, + VideoCreateError, + VideoCreateParams, + VideoDeleteResponse, + VideoDownloadContentParams, + VideoListParams, + VideoModel, + VideoRemixParams, + VideoSeconds, + VideoSize, + Videos, + VideosPage, +} from './resources/videos'; import { Webhooks } from './resources/webhooks'; import { Audio, AudioModel, AudioResponseFormat } from './resources/audio/audio'; import { Beta } from './resources/beta/beta'; @@ -1004,6 +1018,7 @@ export class OpenAI { conversations: API.Conversations = new API.Conversations(this); evals: API.Evals = new API.Evals(this); containers: API.Containers = new API.Containers(this); + videos: API.Videos = new API.Videos(this); } OpenAI.Completions = Completions; @@ -1026,6 +1041,7 @@ OpenAI.Realtime = Realtime; OpenAI.Conversations = Conversations; OpenAI.Evals = Evals; OpenAI.Containers = Containers; +OpenAI.Videos = Videos; export declare namespace OpenAI { export type RequestOptions = Opts.RequestOptions; @@ -1235,6 +1251,21 @@ export declare namespace OpenAI { type ContainerListParams as ContainerListParams, }; + export { + Videos as Videos, + type Video as Video, + type VideoCreateError as VideoCreateError, + type VideoModel as VideoModel, + type VideoSeconds as VideoSeconds, + type VideoSize as VideoSize, + type VideoDeleteResponse as VideoDeleteResponse, + type VideosPage as VideosPage, + type VideoCreateParams as VideoCreateParams, + type VideoListParams as VideoListParams, + type VideoDownloadContentParams as VideoDownloadContentParams, + type VideoRemixParams as VideoRemixParams, + }; + export type AllModels = API.AllModels; export type ChatModel = API.ChatModel; export type ComparisonFilter = API.ComparisonFilter; diff --git a/src/internal/to-file.ts b/src/internal/to-file.ts index 245e84933..30eada32c 100644 --- a/src/internal/to-file.ts +++ b/src/internal/to-file.ts @@ -73,7 +73,7 @@ export type ToFileInput = /** * Helper for creating a {@link File} to pass to an SDK upload method from a variety of different data formats - * @param value the raw content of the file. Can be an {@link Uploadable}, {@link BlobLikePart}, or {@link AsyncIterable} of {@link BlobLikePart}s + * @param value the raw content of the file. Can be an {@link Uploadable}, BlobLikePart, or AsyncIterable of BlobLikeParts * @param {string=} name the name of the file. If omitted, toFile will try to determine a file name from bits if possible * @param {Object=} options additional properties * @param {string=} options.type the MIME type of the content diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts index 0d6b5e6f3..f732fcbe5 100644 --- a/src/resources/beta/beta.ts +++ b/src/resources/beta/beta.ts @@ -73,6 +73,15 @@ import { TranscriptionSessionUpdate, TranscriptionSessionUpdatedEvent, } from './realtime/realtime'; +import * as ChatKitAPI from './chatkit/chatkit'; +import { + ChatKit, + ChatKitUploadFileParams, + ChatKitUploadFileResponse, + ChatKitWorkflow, + FilePart, + ImagePart, +} from './chatkit/chatkit'; import * as ThreadsAPI from './threads/threads'; import { AssistantResponseFormatOption, @@ -93,11 +102,13 @@ import { export class Beta extends APIResource { realtime: RealtimeAPI.Realtime = new RealtimeAPI.Realtime(this._client); + chatkit: ChatKitAPI.ChatKit = new ChatKitAPI.ChatKit(this._client); assistants: AssistantsAPI.Assistants = new AssistantsAPI.Assistants(this._client); threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); } Beta.Realtime = Realtime; +Beta.ChatKit = ChatKit; Beta.Assistants = Assistants; Beta.Threads = Threads; @@ -153,6 +164,12 @@ export declare namespace Beta { type SessionUpdatedEvent as SessionUpdatedEvent, type TranscriptionSessionUpdate as TranscriptionSessionUpdate, type TranscriptionSessionUpdatedEvent as TranscriptionSessionUpdatedEvent, + ChatKit as ChatKit, + type ChatKitWorkflow as ChatKitWorkflow, + type FilePart as FilePart, + type ImagePart as ImagePart, + type ChatKitUploadFileResponse as ChatKitUploadFileResponse, + type ChatKitUploadFileParams as ChatKitUploadFileParams, }; export { diff --git a/src/resources/beta/chatkit.ts b/src/resources/beta/chatkit.ts new file mode 100644 index 000000000..de5c42dc6 --- /dev/null +++ b/src/resources/beta/chatkit.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './chatkit/index'; diff --git a/src/resources/beta/chatkit/chatkit.ts b/src/resources/beta/chatkit/chatkit.ts new file mode 100644 index 000000000..49e271369 --- /dev/null +++ b/src/resources/beta/chatkit/chatkit.ts @@ -0,0 +1,223 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as SessionsAPI from './sessions'; +import { SessionCreateParams, Sessions } from './sessions'; +import * as ThreadsAPI from './threads'; +import { + ChatKitAttachment, + ChatKitResponseOutputText, + ChatKitThread, + ChatKitThreadAssistantMessageItem, + ChatKitThreadItemList, + ChatKitThreadItemListDataPage, + ChatKitThreadUserMessageItem, + ChatKitThreadsPage, + ChatKitWidgetItem, + ChatSession, + ChatSessionAutomaticThreadTitling, + ChatSessionChatKitConfiguration, + ChatSessionChatKitConfigurationParam, + ChatSessionExpiresAfterParam, + ChatSessionFileUpload, + ChatSessionHistory, + ChatSessionRateLimits, + ChatSessionRateLimitsParam, + ChatSessionStatus, + ChatSessionWorkflowParam, + ThreadDeleteResponse, + ThreadListItemsParams, + ThreadListParams, + Threads, +} from './threads'; +import { APIPromise } from '../../../core/api-promise'; +import { type Uploadable } from '../../../core/uploads'; +import { buildHeaders } from '../../../internal/headers'; +import { RequestOptions } from '../../../internal/request-options'; +import { maybeMultipartFormRequestOptions } from '../../../internal/uploads'; + +export class ChatKit extends APIResource { + sessions: SessionsAPI.Sessions = new SessionsAPI.Sessions(this._client); + threads: ThreadsAPI.Threads = new ThreadsAPI.Threads(this._client); + + /** + * Upload a ChatKit file + * + * @example + * ```ts + * const response = await client.beta.chatkit.uploadFile({ + * file: fs.createReadStream('path/to/file'), + * }); + * ``` + */ + uploadFile(body: ChatKitUploadFileParams, options?: RequestOptions): APIPromise { + return this._client.post( + '/chatkit/files', + maybeMultipartFormRequestOptions( + { body, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]) }, + this._client, + ), + ); + } +} + +/** + * Workflow metadata and state returned for the session. + */ +export interface ChatKitWorkflow { + /** + * Identifier of the workflow backing the session. + */ + id: string; + + /** + * State variable key-value pairs applied when invoking the workflow. Defaults to + * null when no overrides were provided. + */ + state_variables: { [key: string]: string | boolean | number } | null; + + /** + * Tracing settings applied to the workflow. + */ + tracing: ChatKitWorkflow.Tracing; + + /** + * Specific workflow version used for the session. Defaults to null when using the + * latest deployment. + */ + version: string | null; +} + +export namespace ChatKitWorkflow { + /** + * Tracing settings applied to the workflow. + */ + export interface Tracing { + /** + * Indicates whether tracing is enabled. + */ + enabled: boolean; + } +} + +/** + * Metadata for a non-image file uploaded through ChatKit. + */ +export interface FilePart { + /** + * Unique identifier for the uploaded file. + */ + id: string; + + /** + * MIME type reported for the uploaded file. Defaults to null when unknown. + */ + mime_type: string | null; + + /** + * Original filename supplied by the uploader. Defaults to null when unnamed. + */ + name: string | null; + + /** + * Type discriminator that is always `file`. + */ + type: 'file'; + + /** + * Signed URL for downloading the uploaded file. Defaults to null when no download + * link is available. + */ + upload_url: string | null; +} + +/** + * Metadata for an image uploaded through ChatKit. + */ +export interface ImagePart { + /** + * Unique identifier for the uploaded image. + */ + id: string; + + /** + * MIME type of the uploaded image. + */ + mime_type: string; + + /** + * Original filename for the uploaded image. Defaults to null when unnamed. + */ + name: string | null; + + /** + * Preview URL that can be rendered inline for the image. + */ + preview_url: string; + + /** + * Type discriminator that is always `image`. + */ + type: 'image'; + + /** + * Signed URL for downloading the uploaded image. Defaults to null when no download + * link is available. + */ + upload_url: string | null; +} + +/** + * Represents either a file or image attachment. + */ +export type ChatKitUploadFileResponse = FilePart | ImagePart; + +export interface ChatKitUploadFileParams { + /** + * Binary file contents to store with the ChatKit session. Supports PDFs and PNG, + * JPG, JPEG, GIF, or WEBP images. + */ + file: Uploadable; +} + +ChatKit.Sessions = Sessions; +ChatKit.Threads = Threads; + +export declare namespace ChatKit { + export { + type ChatKitWorkflow as ChatKitWorkflow, + type FilePart as FilePart, + type ImagePart as ImagePart, + type ChatKitUploadFileResponse as ChatKitUploadFileResponse, + type ChatKitUploadFileParams as ChatKitUploadFileParams, + }; + + export { Sessions as Sessions, type SessionCreateParams as SessionCreateParams }; + + export { + Threads as Threads, + type ChatSession as ChatSession, + type ChatSessionAutomaticThreadTitling as ChatSessionAutomaticThreadTitling, + type ChatSessionChatKitConfiguration as ChatSessionChatKitConfiguration, + type ChatSessionChatKitConfigurationParam as ChatSessionChatKitConfigurationParam, + type ChatSessionExpiresAfterParam as ChatSessionExpiresAfterParam, + type ChatSessionFileUpload as ChatSessionFileUpload, + type ChatSessionHistory as ChatSessionHistory, + type ChatSessionRateLimits as ChatSessionRateLimits, + type ChatSessionRateLimitsParam as ChatSessionRateLimitsParam, + type ChatSessionStatus as ChatSessionStatus, + type ChatSessionWorkflowParam as ChatSessionWorkflowParam, + type ChatKitAttachment as ChatKitAttachment, + type ChatKitResponseOutputText as ChatKitResponseOutputText, + type ChatKitThread as ChatKitThread, + type ChatKitThreadAssistantMessageItem as ChatKitThreadAssistantMessageItem, + type ChatKitThreadItemList as ChatKitThreadItemList, + type ChatKitThreadUserMessageItem as ChatKitThreadUserMessageItem, + type ChatKitWidgetItem as ChatKitWidgetItem, + type ThreadDeleteResponse as ThreadDeleteResponse, + type ChatKitThreadsPage as ChatKitThreadsPage, + type ChatKitThreadItemListDataPage as ChatKitThreadItemListDataPage, + type ThreadListParams as ThreadListParams, + type ThreadListItemsParams as ThreadListItemsParams, + }; +} diff --git a/src/resources/beta/chatkit/index.ts b/src/resources/beta/chatkit/index.ts new file mode 100644 index 000000000..30d1533f7 --- /dev/null +++ b/src/resources/beta/chatkit/index.ts @@ -0,0 +1,37 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ChatKit, + type ChatKitWorkflow, + type FilePart, + type ImagePart, + type ChatKitUploadFileResponse, + type ChatKitUploadFileParams, +} from './chatkit'; +export { Sessions, type SessionCreateParams } from './sessions'; +export { + Threads, + type ChatSession, + type ChatSessionAutomaticThreadTitling, + type ChatSessionChatKitConfiguration, + type ChatSessionChatKitConfigurationParam, + type ChatSessionExpiresAfterParam, + type ChatSessionFileUpload, + type ChatSessionHistory, + type ChatSessionRateLimits, + type ChatSessionRateLimitsParam, + type ChatSessionStatus, + type ChatSessionWorkflowParam, + type ChatKitAttachment, + type ChatKitResponseOutputText, + type ChatKitThread, + type ChatKitThreadAssistantMessageItem, + type ChatKitThreadItemList, + type ChatKitThreadUserMessageItem, + type ChatKitWidgetItem, + type ThreadDeleteResponse, + type ThreadListParams, + type ThreadListItemsParams, + type ChatKitThreadsPage, + type ChatKitThreadItemListDataPage, +} from './threads'; diff --git a/src/resources/beta/chatkit/sessions.ts b/src/resources/beta/chatkit/sessions.ts new file mode 100644 index 000000000..225790e15 --- /dev/null +++ b/src/resources/beta/chatkit/sessions.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as ThreadsAPI from './threads'; +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 Sessions extends APIResource { + /** + * Create a ChatKit session + * + * @example + * ```ts + * const chatSession = + * await client.beta.chatkit.sessions.create({ + * user: 'x', + * workflow: { id: 'id' }, + * }); + * ``` + */ + create(body: SessionCreateParams, options?: RequestOptions): APIPromise { + return this._client.post('/chatkit/sessions', { + body, + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]), + }); + } + + /** + * Cancel a ChatKit session + * + * @example + * ```ts + * const chatSession = + * await client.beta.chatkit.sessions.cancel('cksess_123'); + * ``` + */ + cancel(sessionID: string, options?: RequestOptions): APIPromise { + return this._client.post(path`/chatkit/sessions/${sessionID}/cancel`, { + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]), + }); + } +} + +export interface SessionCreateParams { + /** + * A free-form string that identifies your end user; ensures this Session can + * access other objects that have the same `user` scope. + */ + user: string; + + /** + * Workflow that powers the session. + */ + workflow: ThreadsAPI.ChatSessionWorkflowParam; + + /** + * Optional overrides for ChatKit runtime configuration features + */ + chatkit_configuration?: ThreadsAPI.ChatSessionChatKitConfigurationParam; + + /** + * Optional override for session expiration timing in seconds from creation. + * Defaults to 10 minutes. + */ + expires_after?: ThreadsAPI.ChatSessionExpiresAfterParam; + + /** + * Optional override for per-minute request limits. When omitted, defaults to 10. + */ + rate_limits?: ThreadsAPI.ChatSessionRateLimitsParam; +} + +export declare namespace Sessions { + export { type SessionCreateParams as SessionCreateParams }; +} diff --git a/src/resources/beta/chatkit/threads.ts b/src/resources/beta/chatkit/threads.ts new file mode 100644 index 000000000..b3456597d --- /dev/null +++ b/src/resources/beta/chatkit/threads.ts @@ -0,0 +1,1037 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../core/resource'; +import * as ChatKitAPI from './chatkit'; +import { APIPromise } from '../../../core/api-promise'; +import { + ConversationCursorPage, + type ConversationCursorPageParams, + PagePromise, +} from '../../../core/pagination'; +import { buildHeaders } from '../../../internal/headers'; +import { RequestOptions } from '../../../internal/request-options'; +import { path } from '../../../internal/utils/path'; + +export class Threads extends APIResource { + /** + * Retrieve a ChatKit thread + * + * @example + * ```ts + * const chatkitThread = + * await client.beta.chatkit.threads.retrieve('cthr_123'); + * ``` + */ + retrieve(threadID: string, options?: RequestOptions): APIPromise { + return this._client.get(path`/chatkit/threads/${threadID}`, { + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]), + }); + } + + /** + * List ChatKit threads + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const chatkitThread of client.beta.chatkit.threads.list()) { + * // ... + * } + * ``` + */ + list( + query: ThreadListParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise { + return this._client.getAPIList('/chatkit/threads', ConversationCursorPage, { + query, + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]), + }); + } + + /** + * Delete a ChatKit thread + * + * @example + * ```ts + * const thread = await client.beta.chatkit.threads.delete( + * 'cthr_123', + * ); + * ``` + */ + delete(threadID: string, options?: RequestOptions): APIPromise { + return this._client.delete(path`/chatkit/threads/${threadID}`, { + ...options, + headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]), + }); + } + + /** + * List ChatKit thread items + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const thread of client.beta.chatkit.threads.listItems( + * 'cthr_123', + * )) { + * // ... + * } + * ``` + */ + listItems( + threadID: string, + query: ThreadListItemsParams | null | undefined = {}, + options?: RequestOptions, + ): PagePromise< + ChatKitThreadItemListDataPage, + | ChatKitThreadUserMessageItem + | ChatKitThreadAssistantMessageItem + | ChatKitWidgetItem + | ChatKitThreadItemList.ChatKitClientToolCall + | ChatKitThreadItemList.ChatKitTask + | ChatKitThreadItemList.ChatKitTaskGroup + > { + return this._client.getAPIList( + path`/chatkit/threads/${threadID}/items`, + ConversationCursorPage< + | ChatKitThreadUserMessageItem + | ChatKitThreadAssistantMessageItem + | ChatKitWidgetItem + | ChatKitThreadItemList.ChatKitClientToolCall + | ChatKitThreadItemList.ChatKitTask + | ChatKitThreadItemList.ChatKitTaskGroup + >, + { query, ...options, headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]) }, + ); + } +} + +export type ChatKitThreadsPage = ConversationCursorPage; + +export type ChatKitThreadItemListDataPage = ConversationCursorPage< + | ChatKitThreadUserMessageItem + | ChatKitThreadAssistantMessageItem + | ChatKitWidgetItem + | ChatKitThreadItemList.ChatKitClientToolCall + | ChatKitThreadItemList.ChatKitTask + | ChatKitThreadItemList.ChatKitTaskGroup +>; + +/** + * Represents a ChatKit session and its resolved configuration. + */ +export interface ChatSession { + /** + * Identifier for the ChatKit session. + */ + id: string; + + /** + * Resolved ChatKit feature configuration for the session. + */ + chatkit_configuration: ChatSessionChatKitConfiguration; + + /** + * Ephemeral client secret that authenticates session requests. + */ + client_secret: string; + + /** + * Unix timestamp (in seconds) for when the session expires. + */ + expires_at: number; + + /** + * Convenience copy of the per-minute request limit. + */ + max_requests_per_1_minute: number; + + /** + * Type discriminator that is always `chatkit.session`. + */ + object: 'chatkit.session'; + + /** + * Resolved rate limit values. + */ + rate_limits: ChatSessionRateLimits; + + /** + * Current lifecycle state of the session. + */ + status: ChatSessionStatus; + + /** + * User identifier associated with the session. + */ + user: string; + + /** + * Workflow metadata for the session. + */ + workflow: ChatKitAPI.ChatKitWorkflow; +} + +/** + * Automatic thread title preferences for the session. + */ +export interface ChatSessionAutomaticThreadTitling { + /** + * Whether automatic thread titling is enabled. + */ + enabled: boolean; +} + +/** + * ChatKit configuration for the session. + */ +export interface ChatSessionChatKitConfiguration { + /** + * Automatic thread titling preferences. + */ + automatic_thread_titling: ChatSessionAutomaticThreadTitling; + + /** + * Upload settings for the session. + */ + file_upload: ChatSessionFileUpload; + + /** + * History retention configuration. + */ + history: ChatSessionHistory; +} + +/** + * Optional per-session configuration settings for ChatKit behavior. + */ +export interface ChatSessionChatKitConfigurationParam { + /** + * Configuration for automatic thread titling. When omitted, automatic thread + * titling is enabled by default. + */ + automatic_thread_titling?: ChatSessionChatKitConfigurationParam.AutomaticThreadTitling; + + /** + * Configuration for upload enablement and limits. When omitted, uploads are + * disabled by default (max_files 10, max_file_size 512 MB). + */ + file_upload?: ChatSessionChatKitConfigurationParam.FileUpload; + + /** + * Configuration for chat history retention. When omitted, history is enabled by + * default with no limit on recent_threads (null). + */ + history?: ChatSessionChatKitConfigurationParam.History; +} + +export namespace ChatSessionChatKitConfigurationParam { + /** + * Configuration for automatic thread titling. When omitted, automatic thread + * titling is enabled by default. + */ + export interface AutomaticThreadTitling { + /** + * Enable automatic thread title generation. Defaults to true. + */ + enabled?: boolean; + } + + /** + * Configuration for upload enablement and limits. When omitted, uploads are + * disabled by default (max_files 10, max_file_size 512 MB). + */ + export interface FileUpload { + /** + * Enable uploads for this session. Defaults to false. + */ + enabled?: boolean; + + /** + * Maximum size in megabytes for each uploaded file. Defaults to 512 MB, which is + * the maximum allowable size. + */ + max_file_size?: number; + + /** + * Maximum number of files that can be uploaded to the session. Defaults to 10. + */ + max_files?: number; + } + + /** + * Configuration for chat history retention. When omitted, history is enabled by + * default with no limit on recent_threads (null). + */ + export interface History { + /** + * Enables chat users to access previous ChatKit threads. Defaults to true. + */ + enabled?: boolean; + + /** + * Number of recent ChatKit threads users have access to. Defaults to unlimited + * when unset. + */ + recent_threads?: number; + } +} + +/** + * Controls when the session expires relative to an anchor timestamp. + */ +export interface ChatSessionExpiresAfterParam { + /** + * Base timestamp used to calculate expiration. Currently fixed to `created_at`. + */ + anchor: 'created_at'; + + /** + * Number of seconds after the anchor when the session expires. + */ + seconds: number; +} + +/** + * Upload permissions and limits applied to the session. + */ +export interface ChatSessionFileUpload { + /** + * Indicates if uploads are enabled for the session. + */ + enabled: boolean; + + /** + * Maximum upload size in megabytes. + */ + max_file_size: number | null; + + /** + * Maximum number of uploads allowed during the session. + */ + max_files: number | null; +} + +/** + * History retention preferences returned for the session. + */ +export interface ChatSessionHistory { + /** + * Indicates if chat history is persisted for the session. + */ + enabled: boolean; + + /** + * Number of prior threads surfaced in history views. Defaults to null when all + * history is retained. + */ + recent_threads: number | null; +} + +/** + * Active per-minute request limit for the session. + */ +export interface ChatSessionRateLimits { + /** + * Maximum allowed requests per one-minute window. + */ + max_requests_per_1_minute: number; +} + +/** + * Controls request rate limits for the session. + */ +export interface ChatSessionRateLimitsParam { + /** + * Maximum number of requests allowed per minute for the session. Defaults to 10. + */ + max_requests_per_1_minute?: number; +} + +export type ChatSessionStatus = 'active' | 'expired' | 'cancelled'; + +/** + * Workflow reference and overrides applied to the chat session. + */ +export interface ChatSessionWorkflowParam { + /** + * Identifier for the workflow invoked by the session. + */ + id: string; + + /** + * State variables forwarded to the workflow. Keys may be up to 64 characters, + * values must be primitive types, and the map defaults to an empty object. + */ + state_variables?: { [key: string]: string | boolean | number }; + + /** + * Optional tracing overrides for the workflow invocation. When omitted, tracing is + * enabled by default. + */ + tracing?: ChatSessionWorkflowParam.Tracing; + + /** + * Specific workflow version to run. Defaults to the latest deployed version. + */ + version?: string; +} + +export namespace ChatSessionWorkflowParam { + /** + * Optional tracing overrides for the workflow invocation. When omitted, tracing is + * enabled by default. + */ + export interface Tracing { + /** + * Whether tracing is enabled during the session. Defaults to true. + */ + enabled?: boolean; + } +} + +/** + * Attachment metadata included on thread items. + */ +export interface ChatKitAttachment { + /** + * Identifier for the attachment. + */ + id: string; + + /** + * MIME type of the attachment. + */ + mime_type: string; + + /** + * Original display name for the attachment. + */ + name: string; + + /** + * Preview URL for rendering the attachment inline. + */ + preview_url: string | null; + + /** + * Attachment discriminator. + */ + type: 'image' | 'file'; +} + +/** + * Assistant response text accompanied by optional annotations. + */ +export interface ChatKitResponseOutputText { + /** + * Ordered list of annotations attached to the response text. + */ + annotations: Array; + + /** + * Assistant generated text. + */ + text: string; + + /** + * Type discriminator that is always `output_text`. + */ + type: 'output_text'; +} + +export namespace ChatKitResponseOutputText { + /** + * Annotation that references an uploaded file. + */ + export interface File { + /** + * File attachment referenced by the annotation. + */ + source: File.Source; + + /** + * Type discriminator that is always `file` for this annotation. + */ + type: 'file'; + } + + export namespace File { + /** + * File attachment referenced by the annotation. + */ + export interface Source { + /** + * Filename referenced by the annotation. + */ + filename: string; + + /** + * Type discriminator that is always `file`. + */ + type: 'file'; + } + } + + /** + * Annotation that references a URL. + */ + export interface URL { + /** + * URL referenced by the annotation. + */ + source: URL.Source; + + /** + * Type discriminator that is always `url` for this annotation. + */ + type: 'url'; + } + + export namespace URL { + /** + * URL referenced by the annotation. + */ + export interface Source { + /** + * Type discriminator that is always `url`. + */ + type: 'url'; + + /** + * URL referenced by the annotation. + */ + url: string; + } + } +} + +/** + * Represents a ChatKit thread and its current status. + */ +export interface ChatKitThread { + /** + * Identifier of the thread. + */ + id: string; + + /** + * Unix timestamp (in seconds) for when the thread was created. + */ + created_at: number; + + /** + * Type discriminator that is always `chatkit.thread`. + */ + object: 'chatkit.thread'; + + /** + * Current status for the thread. Defaults to `active` for newly created threads. + */ + status: ChatKitThread.Active | ChatKitThread.Locked | ChatKitThread.Closed; + + /** + * Optional human-readable title for the thread. Defaults to null when no title has + * been generated. + */ + title: string | null; + + /** + * Free-form string that identifies your end user who owns the thread. + */ + user: string; +} + +export namespace ChatKitThread { + /** + * Indicates that a thread is active. + */ + export interface Active { + /** + * Status discriminator that is always `active`. + */ + type: 'active'; + } + + /** + * Indicates that a thread is locked and cannot accept new input. + */ + export interface Locked { + /** + * Reason that the thread was locked. Defaults to null when no reason is recorded. + */ + reason: string | null; + + /** + * Status discriminator that is always `locked`. + */ + type: 'locked'; + } + + /** + * Indicates that a thread has been closed. + */ + export interface Closed { + /** + * Reason that the thread was closed. Defaults to null when no reason is recorded. + */ + reason: string | null; + + /** + * Status discriminator that is always `closed`. + */ + type: 'closed'; + } +} + +/** + * Assistant-authored message within a thread. + */ +export interface ChatKitThreadAssistantMessageItem { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * Ordered assistant response segments. + */ + content: Array; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + /** + * Type discriminator that is always `chatkit.assistant_message`. + */ + type: 'chatkit.assistant_message'; +} + +/** + * A paginated list of thread items rendered for the ChatKit API. + */ +export interface ChatKitThreadItemList { + /** + * A list of items + */ + data: Array< + | ChatKitThreadUserMessageItem + | ChatKitThreadAssistantMessageItem + | ChatKitWidgetItem + | ChatKitThreadItemList.ChatKitClientToolCall + | ChatKitThreadItemList.ChatKitTask + | ChatKitThreadItemList.ChatKitTaskGroup + >; + + /** + * The ID of the first item in the list. + */ + first_id: string | null; + + /** + * Whether there are more items available. + */ + has_more: boolean; + + /** + * The ID of the last item in the list. + */ + last_id: string | null; + + /** + * The type of object returned, must be `list`. + */ + object: 'list'; +} + +export namespace ChatKitThreadItemList { + /** + * Record of a client side tool invocation initiated by the assistant. + */ + export interface ChatKitClientToolCall { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * JSON-encoded arguments that were sent to the tool. + */ + arguments: string; + + /** + * Identifier for the client tool call. + */ + call_id: string; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Tool name that was invoked. + */ + name: string; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * JSON-encoded output captured from the tool. Defaults to null while execution is + * in progress. + */ + output: string | null; + + /** + * Execution status for the tool call. + */ + status: 'in_progress' | 'completed'; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + /** + * Type discriminator that is always `chatkit.client_tool_call`. + */ + type: 'chatkit.client_tool_call'; + } + + /** + * Task emitted by the workflow to show progress and status updates. + */ + export interface ChatKitTask { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Optional heading for the task. Defaults to null when not provided. + */ + heading: string | null; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * Optional summary that describes the task. Defaults to null when omitted. + */ + summary: string | null; + + /** + * Subtype for the task. + */ + task_type: 'custom' | 'thought'; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + /** + * Type discriminator that is always `chatkit.task`. + */ + type: 'chatkit.task'; + } + + /** + * Collection of workflow tasks grouped together in the thread. + */ + export interface ChatKitTaskGroup { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * Tasks included in the group. + */ + tasks: Array; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + /** + * Type discriminator that is always `chatkit.task_group`. + */ + type: 'chatkit.task_group'; + } + + export namespace ChatKitTaskGroup { + /** + * Task entry that appears within a TaskGroup. + */ + export interface Task { + /** + * Optional heading for the grouped task. Defaults to null when not provided. + */ + heading: string | null; + + /** + * Optional summary that describes the grouped task. Defaults to null when omitted. + */ + summary: string | null; + + /** + * Subtype for the grouped task. + */ + type: 'custom' | 'thought'; + } + } +} + +/** + * User-authored messages within a thread. + */ +export interface ChatKitThreadUserMessageItem { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * Attachments associated with the user message. Defaults to an empty list. + */ + attachments: Array; + + /** + * Ordered content elements supplied by the user. + */ + content: Array; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Inference overrides applied to the message. Defaults to null when unset. + */ + inference_options: ChatKitThreadUserMessageItem.InferenceOptions | null; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + type: 'chatkit.user_message'; +} + +export namespace ChatKitThreadUserMessageItem { + /** + * Text block that a user contributed to the thread. + */ + export interface InputText { + /** + * Plain-text content supplied by the user. + */ + text: string; + + /** + * Type discriminator that is always `input_text`. + */ + type: 'input_text'; + } + + /** + * Quoted snippet that the user referenced in their message. + */ + export interface QuotedText { + /** + * Quoted text content. + */ + text: string; + + /** + * Type discriminator that is always `quoted_text`. + */ + type: 'quoted_text'; + } + + /** + * Inference overrides applied to the message. Defaults to null when unset. + */ + export interface InferenceOptions { + /** + * Model name that generated the response. Defaults to null when using the session + * default. + */ + model: string | null; + + /** + * Preferred tool to invoke. Defaults to null when ChatKit should auto-select. + */ + tool_choice: InferenceOptions.ToolChoice | null; + } + + export namespace InferenceOptions { + /** + * Preferred tool to invoke. Defaults to null when ChatKit should auto-select. + */ + export interface ToolChoice { + /** + * Identifier of the requested tool. + */ + id: string; + } + } +} + +/** + * Thread item that renders a widget payload. + */ +export interface ChatKitWidgetItem { + /** + * Identifier of the thread item. + */ + id: string; + + /** + * Unix timestamp (in seconds) for when the item was created. + */ + created_at: number; + + /** + * Type discriminator that is always `chatkit.thread_item`. + */ + object: 'chatkit.thread_item'; + + /** + * Identifier of the parent thread. + */ + thread_id: string; + + /** + * Type discriminator that is always `chatkit.widget`. + */ + type: 'chatkit.widget'; + + /** + * Serialized widget payload rendered in the UI. + */ + widget: string; +} + +/** + * Confirmation payload returned after deleting a thread. + */ +export interface ThreadDeleteResponse { + /** + * Identifier of the deleted thread. + */ + id: string; + + /** + * Indicates that the thread has been deleted. + */ + deleted: boolean; + + /** + * Type discriminator that is always `chatkit.thread.deleted`. + */ + object: 'chatkit.thread.deleted'; +} + +export interface ThreadListParams extends ConversationCursorPageParams { + /** + * List items created before this thread item ID. Defaults to null for the newest + * results. + */ + before?: string; + + /** + * Sort order for results by creation time. Defaults to `desc`. + */ + order?: 'asc' | 'desc'; + + /** + * Filter threads that belong to this user identifier. Defaults to null to return + * all users. + */ + user?: string; +} + +export interface ThreadListItemsParams extends ConversationCursorPageParams { + /** + * List items created before this thread item ID. Defaults to null for the newest + * results. + */ + before?: string; + + /** + * Sort order for results by creation time. Defaults to `desc`. + */ + order?: 'asc' | 'desc'; +} + +export declare namespace Threads { + export { + type ChatSession as ChatSession, + type ChatSessionAutomaticThreadTitling as ChatSessionAutomaticThreadTitling, + type ChatSessionChatKitConfiguration as ChatSessionChatKitConfiguration, + type ChatSessionChatKitConfigurationParam as ChatSessionChatKitConfigurationParam, + type ChatSessionExpiresAfterParam as ChatSessionExpiresAfterParam, + type ChatSessionFileUpload as ChatSessionFileUpload, + type ChatSessionHistory as ChatSessionHistory, + type ChatSessionRateLimits as ChatSessionRateLimits, + type ChatSessionRateLimitsParam as ChatSessionRateLimitsParam, + type ChatSessionStatus as ChatSessionStatus, + type ChatSessionWorkflowParam as ChatSessionWorkflowParam, + type ChatKitAttachment as ChatKitAttachment, + type ChatKitResponseOutputText as ChatKitResponseOutputText, + type ChatKitThread as ChatKitThread, + type ChatKitThreadAssistantMessageItem as ChatKitThreadAssistantMessageItem, + type ChatKitThreadItemList as ChatKitThreadItemList, + type ChatKitThreadUserMessageItem as ChatKitThreadUserMessageItem, + type ChatKitWidgetItem as ChatKitWidgetItem, + type ThreadDeleteResponse as ThreadDeleteResponse, + type ChatKitThreadsPage as ChatKitThreadsPage, + type ChatKitThreadItemListDataPage as ChatKitThreadItemListDataPage, + type ThreadListParams as ThreadListParams, + type ThreadListItemsParams as ThreadListItemsParams, + }; +} diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts index a4d5a7ea6..2dda802e6 100644 --- a/src/resources/beta/index.ts +++ b/src/resources/beta/index.ts @@ -20,6 +20,14 @@ export { } from './assistants'; export { Beta } from './beta'; export { Realtime } from './realtime/index'; +export { + ChatKit, + type ChatKitWorkflow, + type FilePart, + type ImagePart, + type ChatKitUploadFileResponse, + type ChatKitUploadFileParams, +} from './chatkit/index'; export { Threads, type AssistantResponseFormatOption, diff --git a/src/resources/images.ts b/src/resources/images.ts index 8f1dad624..fce5a1b66 100644 --- a/src/resources/images.ts +++ b/src/resources/images.ts @@ -386,7 +386,7 @@ export interface ImageGenPartialImageEvent { */ export type ImageGenStreamEvent = ImageGenPartialImageEvent | ImageGenCompletedEvent; -export type ImageModel = 'dall-e-2' | 'dall-e-3' | 'gpt-image-1'; +export type ImageModel = 'dall-e-2' | 'dall-e-3' | 'gpt-image-1' | 'gpt-image-1-mini'; /** * The response from the image generation endpoint. @@ -547,7 +547,8 @@ export interface ImageEditParamsBase { /** * Control how much effort the model will exert to match the style and features, * especially facial features, of input images. This parameter is only supported - * for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`. + * for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and + * `low`. Defaults to `low`. */ input_fidelity?: 'high' | 'low' | null; diff --git a/src/resources/index.ts b/src/resources/index.ts index 5164f863d..c54354ca5 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -118,4 +118,18 @@ export { type VectorStoresPage, type VectorStoreSearchResponsesPage, } from './vector-stores/vector-stores'; +export { + Videos, + type Video, + type VideoCreateError, + type VideoModel, + type VideoSeconds, + type VideoSize, + type VideoDeleteResponse, + type VideoCreateParams, + type VideoListParams, + type VideoDownloadContentParams, + type VideoRemixParams, + type VideosPage, +} from './videos'; export { Webhooks } from './webhooks'; diff --git a/src/resources/realtime/calls.ts b/src/resources/realtime/calls.ts index 089855fc2..9ef6acdde 100644 --- a/src/resources/realtime/calls.ts +++ b/src/resources/realtime/calls.ts @@ -135,7 +135,11 @@ export interface CallAcceptParams { | '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'; + | 'gpt-4o-mini-realtime-preview-2024-12-17' + | 'gpt-realtime-mini' + | 'gpt-realtime-mini-2025-10-06' + | 'gpt-audio-mini' + | 'gpt-audio-mini-2025-10-06'; /** * The set of modalities the model can respond with. It defaults to `["audio"]`, diff --git a/src/resources/realtime/client-secrets.ts b/src/resources/realtime/client-secrets.ts index 6289663fe..2de01d878 100644 --- a/src/resources/realtime/client-secrets.ts +++ b/src/resources/realtime/client-secrets.ts @@ -102,7 +102,11 @@ export interface RealtimeSessionCreateResponse { | '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'; + | 'gpt-4o-mini-realtime-preview-2024-12-17' + | 'gpt-realtime-mini' + | 'gpt-realtime-mini-2025-10-06' + | 'gpt-audio-mini' + | 'gpt-audio-mini-2025-10-06'; /** * The set of modalities the model can respond with. It defaults to `["audio"]`, diff --git a/src/resources/realtime/realtime.ts b/src/resources/realtime/realtime.ts index 49d22a39d..1e5a09c4e 100644 --- a/src/resources/realtime/realtime.ts +++ b/src/resources/realtime/realtime.ts @@ -2726,7 +2726,11 @@ export interface RealtimeSession { | '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'; + | 'gpt-4o-mini-realtime-preview-2024-12-17' + | 'gpt-realtime-mini' + | 'gpt-realtime-mini-2025-10-06' + | 'gpt-audio-mini' + | 'gpt-audio-mini-2025-10-06'; /** * The object type. Always `realtime.session`. @@ -3003,7 +3007,11 @@ export interface RealtimeSessionCreateRequest { | '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'; + | 'gpt-4o-mini-realtime-preview-2024-12-17' + | 'gpt-realtime-mini' + | 'gpt-realtime-mini-2025-10-06' + | 'gpt-audio-mini' + | 'gpt-audio-mini-2025-10-06'; /** * The set of modalities the model can respond with. It defaults to `["audio"]`, diff --git a/src/resources/responses/responses.ts b/src/resources/responses/responses.ts index 14069f9fa..da365ead7 100644 --- a/src/resources/responses/responses.ts +++ b/src/resources/responses/responses.ts @@ -5068,7 +5068,8 @@ export namespace Tool { /** * Control how much effort the model will exert to match the style and features, * especially facial features, of input images. This parameter is only supported - * for `gpt-image-1`. Supports `high` and `low`. Defaults to `low`. + * for `gpt-image-1`. Unsupported for `gpt-image-1-mini`. Supports `high` and + * `low`. Defaults to `low`. */ input_fidelity?: 'high' | 'low' | null; @@ -5081,7 +5082,7 @@ export namespace Tool { /** * The image generation model to use. Default: `gpt-image-1`. */ - model?: 'gpt-image-1'; + model?: 'gpt-image-1' | 'gpt-image-1-mini'; /** * Moderation level for the generated image. Default: `auto`. diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 51d18456b..8a2e0cb63 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -13,7 +13,9 @@ export type AllModels = | 'o4-mini-deep-research-2025-06-26' | 'computer-use-preview' | 'computer-use-preview-2025-03-11' - | 'gpt-5-codex'; + | 'gpt-5-codex' + | 'gpt-5-pro' + | 'gpt-5-pro-2025-10-06'; export type ChatModel = | 'gpt-5' @@ -382,4 +384,6 @@ export type ResponsesModel = | 'o4-mini-deep-research-2025-06-26' | 'computer-use-preview' | 'computer-use-preview-2025-03-11' - | 'gpt-5-codex'; + | 'gpt-5-codex' + | 'gpt-5-pro' + | 'gpt-5-pro-2025-10-06'; diff --git a/src/resources/videos.ts b/src/resources/videos.ts new file mode 100644 index 000000000..71de2a308 --- /dev/null +++ b/src/resources/videos.ts @@ -0,0 +1,233 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../core/resource'; +import { APIPromise } from '../core/api-promise'; +import { ConversationCursorPage, type ConversationCursorPageParams, PagePromise } from '../core/pagination'; +import { type Uploadable } from '../core/uploads'; +import { buildHeaders } from '../internal/headers'; +import { RequestOptions } from '../internal/request-options'; +import { maybeMultipartFormRequestOptions } from '../internal/uploads'; +import { path } from '../internal/utils/path'; + +export class Videos extends APIResource { + /** + * Create a video + */ + create(body: VideoCreateParams, options?: RequestOptions): APIPromise