Skip to Content
🚀 Orga AI is in open beta.

OrgaAI

The OrgaAI class manages global configuration for the core runtime. It is a static singleton; you do not instantiate it with new.

OrgaAI.init(config)

Initializes the runtime. Must be called before using utilities such as connectToRealtime.

import { OrgaAI } from '@orga-ai/core'; OrgaAI.init({ sessionConfigEndpoint: '/api/orga/session', logLevel: 'info', model: 'orga-1-beta', voice: 'alloy', temperature: 0.4, });
OptionTypeRequiredDescription
sessionConfigEndpointstring❌*URL to your backend endpoint that returns { ephemeralToken, iceServers }. Required unless fetchSessionConfig is provided.
fetchSessionConfig() => Promise<SessionConfigResponse>❌*Custom fetcher for session credentials. Used when you cannot expose an HTTP endpoint.
logLevel'debug' | 'info' | 'warn' | 'error' | 'disabled'Controls verbosity of the bundled logger. Default warn.
timeoutnumberBase timeout (ms) for helper functions. Default 30000.
modelOrgaAIModelDefault model applied to realtime calls.
voiceOrgaAIVoiceDefault voice configuration.
temperaturenumberSampling temperature; validated against ORGAAI_TEMPERATURE_RANGE.
instructionsstringDefault system prompt for the agent.
modalitiesModality[]Modalities requested during realtime negotiation.
historybooleanWhether to request historical context by default.

Either sessionConfigEndpoint or fetchSessionConfig must be provided; otherwise ConfigurationError is thrown.

OrgaAI.getConfig()

Returns the resolved configuration with defaults applied.

const config = OrgaAI.getConfig(); console.log(config.model); // -> 'orga-1-beta'

Throws ConfigurationError if OrgaAI.init has not run.

OrgaAI.isInitialized()

if (!OrgaAI.isInitialized()) { OrgaAI.init({ sessionConfigEndpoint: '/api/orga/session' }); }

Returns true when the runtime has been initialized.

OrgaAI.reset() (internal)

Clears the global configuration. Intended for tests; avoid calling it in production.

Last updated on