Implementation:Openai Openai node Beta Resource
| Knowledge Sources | |
|---|---|
| Domains | SDK, Beta |
| Last Updated | 2026-02-15 12:00 GMT |
Overview
The Beta resource class serves as a namespace that groups together all beta-stage sub-resources including Realtime, ChatKit, Assistants, and Threads.
Description
The Beta class extends APIResource and acts as an organizational container for OpenAI features that are currently in beta. It does not define any API methods of its own. Instead, it instantiates and exposes four sub-resources as properties: realtime (for the Realtime API), chatkit (for ChatKit sessions and threads), assistants (for the Assistants API), and threads (for the Threads API).
The file is substantial (199 lines) primarily because it re-exports a large number of types from each sub-resource module. The Realtime sub-resource alone contributes dozens of event types (such as ConversationCreatedEvent, InputAudioBufferAppendEvent, ResponseTextDeltaEvent, etc.) that define the real-time WebSocket communication protocol. The Assistants sub-resource re-exports types for assistant CRUD operations and streaming events. The Threads sub-resource provides types for thread management and the "create and run" workflow.
This file is auto-generated from the OpenAI OpenAPI specification by the Stainless code generator and serves as the central hub for all beta functionality in the SDK.
Usage
Use the Beta resource when you need to access any OpenAI beta feature. Access sub-resources through client.beta.realtime, client.beta.chatkit, client.beta.assistants, or client.beta.threads. Beta features may change without notice and are subject to different stability guarantees than the main API.
Code Reference
Source Location
- Repository: openai-node
- File: src/resources/beta/beta.ts
Signature
export class Beta extends APIResource {
realtime: RealtimeAPI.Realtime;
chatkit: ChatKitAPI.ChatKit;
assistants: AssistantsAPI.Assistants;
threads: ThreadsAPI.Threads;
}
Import
import OpenAI from 'openai';
I/O Contract
Inputs
The Beta class itself does not accept direct inputs. It delegates to its sub-resources:
| Sub-Resource | Access Path | Description |
|---|---|---|
| Realtime | client.beta.realtime |
Real-time WebSocket communication for audio and text |
| ChatKit | client.beta.chatkit |
ChatKit sessions and threads management |
| Assistants | client.beta.assistants |
CRUD operations for AI assistants |
| Threads | client.beta.threads |
Thread creation, management, and run workflows |
Outputs
| Name | Type | Description |
|---|---|---|
| Realtime types | Various event types | Dozens of client/server event types for real-time communication |
| Assistant types | Assistant, AssistantTool, etc. |
Types for assistant configuration and streaming |
| Thread types | Thread, ThreadCreateAndRunParams, etc. |
Types for thread management and execution |
| ChatKit types | ChatKitWorkflow, etc. |
Types for ChatKit workflow configuration |
Usage Examples
import OpenAI from 'openai';
const client = new OpenAI();
// Access assistants via beta namespace
const assistant = await client.beta.assistants.create({
model: 'gpt-4o',
name: 'Math Tutor',
instructions: 'You are a helpful math tutor.',
});
// Access threads via beta namespace
const thread = await client.beta.threads.create();
// Access ChatKit via beta namespace
const session = await client.beta.chatkit.sessions.create({
user: 'user_123',
workflow: { id: 'workflow_id' },
});