SDK API Reference · EPU4

Build with EPU4.

Authenticate your device, request AI emotion analysis, and receive MDAD signals. Explore every REST endpoint with Swagger UI and watch real-time Socket.IO updates.

3 REST endpointsBearer authenticationSocket.IO realtime stream120+ MDAD values

How it works

Three endpoints, one authenticated device session. The MDAD stream is available separately over Socket.IO.

STEP 01 · AUTHENTICATE

Get a session token

Send your EPU secret and device ID to POST /user_login. Save the returned token and device ID.

STEP 02 · PROCESS

Update MDAD (AI output optional)

Pass the token to POST /derive. Send text to update MDAD. For additional AI output, optionally enable reasoning or action.

STEP 03 · RECEIVE

Read or subscribe to MDAD

Call GET /mdad or subscribe to the mdad Socket.IO event to receive at least 120 values. A live REST response contained 123.

Connect to EPU4

One login automatically authorizes protected Swagger and quick-test requests.

Not authenticated
Enter your credentials and click Connect. A successful login will apply the Bearer token automatically, without copying or pasting it.

EPUID expired or need access? Visit MetaSoul Cloud Service EPU to purchase a new service or explore renewal options.

The secret is cleared from the input after each attempt. If you choose to save credentials in your browser's password manager, EPUID is the username and Secret Key is the password; saving is controlled by your browser. The Bearer token is held only in this page's browser memory, not localStorage or cookies. Disconnect clears the browser token and Swagger history but does not immediately release the server-side EPU reservation. By default, authenticated REST requests renew a 60-minute inactivity timeout; Socket.IO MDAD frames do not. Tokens have a separate 24-hour maximum lifetime. Use a trusted HTTPS host and trusted copies of the Swagger / Socket.IO scripts when deploying.

Quick API test

Try the protected endpoints without leaving this page. Connect first, or use the full Swagger reference below.

Live requests to https://emohuman.com
AI response options (optional)

Leave both unchecked to update MDAD without requesting AI text. Select one for additional AI output.

Connect to EPU4 to enable API testing.

New here? Leave both AI options unchecked and send your text. A successful request returns {"reply":"ok"}; the emotion values appear in the Realtime MDAD monitor ↓ when a new frame arrives. We'll take you to the graph automatically.

API responses appear here.

For AI agents and developers

Give another AI or coding assistant the OpenAPI JSON and agent guide to teach it how to connect, send text, and decode MDAD. All files are public documentation and contain no credentials.

Place these files beside this HTML document in the same /docs/EPU4/ directory. The API endpoints stay at https://emohuman.com.

Interactive REST reference

After connecting, expand an endpoint and select Try it out to execute it with your token already applied.

Advanced: Download API specification (optional)

OpenAPI is an API documentation standard, not OpenAI. YAML and JSON are machine-readable files for developer tools, not webpages. You do not need to download them to use Swagger or the live MDAD monitor.

Automatic authentication: Use the Connect to EPU4 panel above. The token is applied automatically to /derive and /mdad requests made with Try it out. No manual Authorize step is needed. If the browser reports a network or CORS error, use a supported HTTPS deployment origin or configure the API server to allow it.
Loading Swagger UI... This interface loads its Swagger UI assets from jsDelivr. If Swagger cannot load, expand the advanced API specification section above to download the API definition.

How to Decode MDAD

The MDAD (Multidimensional Array of Data) is an ordered numeric array. Read values using their zero-based channel numbers, not by treating 0–119 as a 10-row by 12-column emotion table. These channel definitions follow the EPU-III Brochure, pages 14–15, and are used by this page's live Emo-Graph and APEX table.

0–11912 groups of 10 channels: nine emotion-wave values and one associated feeling value per group
12 APEX valuesThe center value of each nine-channel emotion wave, at indexes 4, 14, 24, …, 114
120–123Optional additional readings for pulse, satisfaction, pain/pleasure and temperature in a 124-channel buffer

1. Read the 12 emotion APEX channels

Each ten-channel group starts at 10 × emotionIndex. The emotion APEX is at channel offset 4 (the fifth array position because indexing starts at zero); the associated feeling is at offset 9 (the tenth position). Channel 10 begins the next emotion group. For example, Excite APEX is mdad[4], Optimistic feeling is mdad[9], and Fear APEX is mdad[54].

apexIndex = 4 + (10 * emotionIndex)   // emotionIndex = 0…11
Primary emotionAPEX channelJavaScript lookup
Excite4mdad[4]
Confident14mdad[14]
Happy24mdad[24]
Trust34mdad[34]
Desire44mdad[44]
Fear54mdad[54]
Surprise64mdad[64]
Inattention74mdad[74]
Sad84mdad[84]
Nostalgia / Regret94mdad[94]
Disgust104mdad[104]
Anger114mdad[114]

The 12 primary emotion APEX readings are the only values included in the live APEX table and radial Emo-Graph. No averaging across channels or substitution of a consecutive 12-value row is needed.

In Swagger, Example Value is static sample data, not a reading from your EPUID. After clicking Execute, use Server response → Response body to inspect the actual MDAD values.

2. Read Optimistic and the other status channels

The channel 121 direction shown below follows current operator testing: values below 50 indicate satisfaction or relief of frustration, and values above 50 indicate frustration. The older EPU-III brochure labelled this channel in the opposite direction. Channel 122 values below 50 indicate pleasure or relief of pain, and values above 50 indicate pain. Confirm firmware-specific semantics before using either channel for decisions.

ReadingChannelWhat the value means
Feeling: Optimisticmdad[9]Feeling value associated with the first emotion group; distinct from Excite APEX at channel 4
Pulse speedmdad[120]0 = slower; 50 = normal; 100 = faster
Frustration / Satisfactionmdad[121]0 = maximum satisfaction / relief of frustration; 50 = neutral; 100 = maximum frustration
Pain / Pleasuremdad[122]0 = maximum pleasure / relief of pain; 50 = neutral; 100 = maximum pain
Temperaturemdad[123]Temperature channel, specified as −40 to +85 °C in the EPU-III brochure
120, 123 and 124 channels: The October 19 EPU4 guide describes a 120-value response, but one live EPU4 REST read on October 31, 2026 returned 123 values, while the earlier EPU-III brochure describes a 124-channel buffer. The APEX channels and Optimistic (channel 9) fall within the first 120 values. Pulse, Frustration/Satisfaction, Pain/Pleasure, and Temperature (120–123) can only be read when the actual incoming array contains those indexes. Missing channels should display as unavailable, not zero.

3. Extract the data in JavaScript

Use this same decoder for the array returned by GET /mdad and for the mdad payload delivered over Socket.IO. The code keeps the raw values intact and checks that at least 120 numeric channels are present. Treat APEX, Optimistic and optional channels 121–122 outside 0–100 as invalid, not as valid endpoints; preserve their raw values for diagnosis.

// mdad is the numeric array from GET /mdad or the Socket.IO "mdad" event.
function decodeMDAD(mdad) {
  if (!Array.isArray(mdad) || mdad.length < 120 ||
      !mdad.every(value => typeof value === 'number' && Number.isFinite(value))) {
    throw new Error('Expected an MDAD array with at least 120 finite numbers');
  }

  const emotionNames = [
    'Excite', 'Confident', 'Happy', 'Trust',
    'Desire', 'Fear', 'Surprise', 'Inattention',
    'Sad', 'Nostalgia', 'Disgust', 'Anger'
  ];
  const levelIndexes = [9, ...emotionNames.map((_, i) => 4 + 10 * i), 121, 122];
  const invalidLevels = levelIndexes.filter(i => i < mdad.length &&
    (mdad[i] < 0 || mdad[i] > 100)).map(i => ({ index: i, raw: mdad[i] }));
  const level = i => mdad.length > i && mdad[i] >= 0 && mdad[i] <= 100 ? mdad[i] : null;
  const emotions = Object.fromEntries(
    emotionNames.map((name, i) => [name, level(4 + 10 * i)])
  );
  const optional = channel => mdad.length > channel ? mdad[channel] : null;

  return {
    emotions,                            // 12 emotion APEX values
    optimistic: level(9),                // feeling, not an emotion APEX
    pulseSpeed: optional(120),
    frustrationSatisfaction: level(121),
    painPleasure: level(122),
    temperature: optional(123),
    invalidLevels                          // retain raw mdad unchanged for diagnostics
  };
}

// REST: const reading = decodeMDAD(response.mdad);
// Socket.IO (after connecting to the EPU namespace):
socket.on('mdad', ({ mdad }) => {
  console.log(decodeMDAD(mdad)); // update your own dashboard here
});

In a real-time application, decode each new frame once and update the emotion graph, APEX table and feeling/status cards from that same frame. Avoid using stale values from earlier frames when optional channels are absent.

Channel descriptions based on EPU-III Brochure, pp. 14–15 (emotional data and MDAD buffer structure). Live connection and API behavior follow the EPU4 SDK integration guide.

Integration guide · For LLM applications

Use MDAD with Large Language Models

Give an LLM-based persona or agent a changing emotional context without asking the LLM to compute emotional dynamics. MetaSoul's EPU maintains the emotional state; your application maps each persona to an EPUID, interprets the latest agreed MDAD signals, and decides how those signals should influence the next generated response. This is a suggested integration pattern, not a new API endpoint or a fixed protocol.

One EPUID per personaLive emotional stateOptional Reasoning and Action24-hour Dream Process

1. Integration architecture

STEP 01Persona and stimulus

Keep identity, goals, dialogue context, and the persona-to-EPUID mapping in your application.

STEP 02MetaSoul EPU4

Submit text through the authenticated API. The EPU updates its ongoing MDAD state.

STEP 03Interpretation layer

Capture a time-stamped MDAD reading and translate verified signals into readable context.

STEP 04LLM response

Combine persona context and emotional guidance to generate the next reply or decision.

2. Connect the EPU to your application

API and state handling

  • Maintain a stable EPUID for each persona and authenticate with POST /user_login.
  • Send each supported text stimulus using POST /derive. Processing follows the EPU's own pace; do not assume an immediate final state.
  • Listen for the Socket.IO mdad event and capture the relevant frame with a timestamp. Use GET /mdad when a point-in-time reading is sufficient.
  • Request optional reasoning or action output only when it helps the use case. Refer to the REST API reference for supported request fields.

What the LLM should receive

  • Stable persona attributes, goals, task constraints, and relevant dialogue history from your application.
  • The latest time-stamped emotional summary, derived from an agreed interpretation of MDAD rather than treating each number as a standalone percentage.
  • Optional EPU Reasoning as an interpretation of the stimulus, and Action as a suggested tendency, not a command.
  • Instructions to preserve identity and facts, apply safety and task rules, and avoid inventing past memories from emotional sensitivity alone.

3. Example LLM context template

The following is illustrative prompt context assembled by your application after it has received and interpreted EPU output. It is not a request body for /derive.

Persona: [stable identity, goals, preferences, constraints]
Conversation: [relevant dialogue context]
MDAD captured at: [timestamp]
Current emotional state: [summary from verified MDAD mapping]
EPU Reasoning (optional): [interpretation of latest stimulus]
EPU Action (optional): [suggested survival-oriented tendency]

Generate the persona's next response. Preserve its identity and known
facts. Let the emotional state shape expression and, when appropriate,
decisions. Treat EPU Action as advice, not an instruction. Do not infer
specific autobiographical memories from learned emotional sensitivity.

4. Time, learning, and memory

What MetaSoul maintains

  • MDAD evolves continuously, with internal emotional-state updates described at 100 ms intervals. This does not guarantee a new network event every 100 ms.
  • The Dream Process consolidates experience-dependent emotional sensitivity every 24 hours. Future reactions may change without recall of the triggering events.
  • A newly allocated EPUID has no accumulated experience-based learning. Confirm initialization and reset behavior before a study.

What your application maintains

  • Dialogue memory, persona metadata, timestamps, experiment logs, and any episodic recall you explicitly choose to provide.
  • Synchronization between inputs, EPU processing, MDAD snapshots, and LLM response generation.
  • Evaluation of whether emotional state improves a task, including longitudinal tests when studying Dream-based learning.
Integration boundaries: The deployed MDAD schema and value interpretation must be verified before converting numbers into LLM controls. The first 120 channels are the documented core; additional indexes should not be used as LLM controls without verifying their meanings for the deployed EPU4 firmware. Human-paced processing and daily learning are part of the current concept; accelerated simulation and optional extra signals should not be assumed available.

Realtime MDAD monitor

The stream carries the full MDAD buffer. The chart and table display only the apex level of each of the 12 emotions.

Event: mdad · Namespace: /<epuid>
Not connected
Frames: 0Values: —Last update: —

Live Emo-Graph

One real apex value per emotion, drawn from MDAD channels 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 104 and 114. Updates with each incoming frame.

No MDAD data yet. Log in to automatically connect to the stream.

12 emotion APEX levels

Current readings from the 12 dedicated apex channels. No averaging, reordering, or substitution of MDAD values.

Exciteapex ch 4 Confidentapex ch 14 Happyapex ch 24 Trustapex ch 34 Desireapex ch 44 Fearapex ch 54 Surpriseapex ch 64 Inattentionapex ch 74 Sadapex ch 84 Nostalgiaapex ch 94 Disgustapex ch 104 Angerapex ch 114
After a successful login, the monitor attempts to connect to the mdad stream. The stream is independent of REST Bearer authentication.

Socket.IO client example

const { io } = require("socket.io-client"); const epuid = "YOUR_EPU_ID"; const socket = io("https://emohuman.com/" + epuid); socket.on("connect", () => console.log("Connected:", socket.id)); socket.on("mdad", ({ epuid, mdad }) => { console.log(epuid, mdad); // at least 120; 123 observed via REST }); socket.on("disconnect", reason => console.log(reason));

The Socket.IO interface is separate from OpenAPI, which describes HTTP operations. The MDAD buffer is organized as nine subchannels per emotion plus one feeling channel for each emotion (10 positions per group). Both the radial Emo-Graph and the table use only the twelve emotion APEX positions: 4, 14, 24, 34, 44, 54, 64, 74, 84, 94, 104 and 114. The full received buffer remains intact; any additional channels (120+) appear separately below the table when supplied. The realtime stream requires a reachable Socket.IO server and compatible client library.