This guide covers building apps that run on top of FlowScale AIOS using our Official Node.js SDK.
For full technical details and advanced usage, reference the main SDK documentation here: packages/sdk/README.md
npm install @flowscale/sdk
Every request requires a session. Call login() once to get a token, then pass it to createClient().
import { login, createClient } from '@flowscale/sdk'
// 1. Authenticate to get a session token
const token = await login({
baseUrl: '<http://localhost:14173>',
username: 'admin',
password: 'your-admin-password',
})
// 2. Initialize the client
const client = createClient({
baseUrl: '<http://localhost:14173>',
sessionToken: token,
})
Fetch all deployed flowscale tools that are ready to run:
const tools = await client.tools.list()
for (const tool of tools) {
console.log(tool.id, tool.name)
// Example: "demo-image-tool-id", "Demo Image Tool"
}
.png)
Each tool has a schemaJson mapping out what inputs it requires. Input keys are always formatted as "${nodeId}__${paramName}".
const tool = await client.tools.get('demo-image-tool-id')
const schema = JSON.parse(tool.schemaJson)
const inputs = schema.filter(f => f.isInput)
for (const field of inputs) {
console.log(`Key: ${field.nodeId}__${field.paramName}`) // e.g. "6__text"
console.log(`Type: ${field.paramType}`) // e.g. "string"
}

Run a tool by passing the required input keys. tools.run() will block and automatically poll the server until the generation is complete.
const result = await client.tools.run('demo-image-tool-id', {
'6__text': 'a photorealistic cat on the moon',
'5__width': 1024,
'5__height': 1024,
})
// Output paths are relative URLs
for (const output of result.outputs) {
const fullUrl = client.resolveUrl(output.path)
console.log(`Generated ${output.kind}:`, fullUrl)
}
