EditorBrain does not currently ship a separate public SDK with its own support contract. The repository has packages/core for validation and resolution, and an internal CLI client; those internal names are not public packages you should install.
For an external integration, use the HTTP API, an MCP client, or invoke the CLI as a process. Do not import internal files from node_modules/editorbrain as if they were a stable API.
Node.js example: read context
This example makes a request. It does not generate anything and it does not spend creative credits:
const token = process.env.EDITORBRAIN_API_KEY;
if (!token) throw new Error('Missing the credential in the environment');
const response = await fetch('https://api.editorbrain.com/v1/workflow/check', {
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({projectId: 'my-project'}),
redirect: 'error',
signal: AbortSignal.timeout(15000)
});
const result = await response.json();
if (!response.ok) {
throw new Error(`${response.status}: ${result.error?.code ?? 'request_failed'}`);
}
console.log(result.editorialSnapshot?.brandId);
Replace the ID with one the credential can access. Do not log the token or the full private context. A timeout limits how long you wait; it does not automatically cancel an operation the server already started.
Call the CLI
import {execFile} from 'node:child_process';
import {promisify} from 'node:util';
const exec = promisify(execFile);
const {stdout} = await exec('editorbrain', [
'workflow', 'check', '--project', 'my-project'
], {timeout: 15000, maxBuffer: 2 * 1024 * 1024});
const workflow = JSON.parse(stdout);
console.log(workflow.mode);
Use separate arguments and do not concatenate user input into a shell command. Keep the error and the exit code, and cap the amount of data. Do not turn a network failure into an automatic retry of a charge.
Core code for repository contributors
The TypeScript core shares validators and resolution between the CLI and the service. The portable folders hold brand, style, project and source hashes. If you contribute to the repository, see packages/core. If you use the product, use versioned public interfaces and do not copy permission or balance logic into the client.