Reference

SDK Reference

Provider, hooks, surfaces, runtime data.

ModelNexProvider

ModelNexProvider is required. Mount it above routed product content.

tsx
<ModelNexProvider
  websiteId="your-website-id"
  userProfile={{
    userId: currentUser.id,
    type: currentUser.role,
    isNewUser: currentUser.isNewUser,
  }}
>
  <App />
</ModelNexProvider>
PropTypeDescription
websiteId Required string Project identifier for the ModelNex integration.
userProfile object Current user identity and audience fields used for targeting and progress state.

Dev tooling is enabled only through a browser-injected __MODELNEX_DEV_MODE_KEY__ value that the SDK verifies for the active websiteId.

Runtime Data Contract

Targeting accuracy

Complete userProfile data makes prompts, workflows, and resume behavior much more reliable.

Hooks

tsx
import { useRunCommand } from '@modelnex/sdk'

function MyAssistant() {
  const runCommand = useRunCommand()

  async function handleSend(input: string, signal?: AbortSignal) {
    return runCommand(input, signal)
  }

  return null
}

Review and Re-Teach

During internal preview sessions, the SDK can pause an in-progress step and capture a corrected recording for that step. When the correction is applied, Portal saves it into the current draft and shows it as the next draft version.

Access control

Keep recording and re-teach access restricted to trusted reviewers. These tools are for authoring and QA, not for customer-facing production use.

UI Surfaces

Primary

ModelNexChatBubble

Unified assistant and workflow surface for most integrations.

Advanced

Custom UI + hooks

Use SDK hooks when you need a bespoke shell or a deeply branded interface.

Integration Guidance

View all guides Previous: Chat Bubble