Each AI Flows provides powerful API to create AI flows programmatically. You can create AI flows, add AI models, and run them with our API.

API Reference

Each has client SDKs and API for triggering AI flows and managing them.

Client SDKs

Initalize SDK

// Please make sure that you run 'npm install @eachlabs/aiflow@latest'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});

Trigger AI Flow

// Please make sure that you run 'npm install @eachlabs/aiflow'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY ||
    'YOUR_API_KEY'
});

const triggerID = await each.flows.trigger("flow-id", {
    parameters: {
        text: "Hello World" // parameters for the flow
    }
});

console.log(triggerID)

Get Executions of a Flow

// Please make sure that you run 'npm install @eachlabs/aiflow'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY ||
    'YOUR_API_KEY'
});

const executions = await each.flows.executions("flow-id");

console.log(executions)

Get Execution Details

// Please make sure that you run 'npm install @eachlabs/aiflow'
import Each from '@eachlabs/aiflow';

const each = new Each({
    auth: process.env.EACH_API_KEY || 'YOUR_API_KEY'
});

const execution = await each.flows.execution("flow-id", "execution-id");

console.log(execution)