IaGenify SDK Alpha: One JavaScript Client for Node.js, the Browser and the Edge
The IaGenify SDK started life as a thin HTTP wrapper around our API. In its alpha it has become the way we build our own tools: one JavaScript client that runs unchanged in Node.js, the browser and Cloudflare Workers, and that hides authentication, sessions and billing guard-rails behind a small, object-oriented surface.
This is not a reference manual. It is a short tour of the ideas we are betting on, a few snippets in the syntax you will actually write, and some hints about where this SDK is heading.
One client, wherever your code runs
The SDK detects its runtime when it starts. In Node.js it keeps its session in a private file under ~/.iagenify/ with owner-only permissions; in the browser it uses localStorage; on the edge it stays in memory. Your API key is exchanged for a short-lived token that is refreshed silently, so application code never touches tokens.
import { IaGenify } from "iagenify"
const api = new IaGenify({
apiKey: process.env.IAGENIFY_API_KEY,
baseUrl: process.env.IAGENIFY_API_URL,
appName: "release-notes-bot",
})
console.log(api.env) // "node" | "browser" | "worker"
console.log(api.capabilities) // { runtime, filesystem, persistentStorage, ... }
const user = await api.getUser()
console.log(`${user.email} has ${user.credits} credits`)Because Node-only modules are loaded lazily after that detection, importing the SDK from a module shared with front-end code does not break a webpack, Vite or Gatsby build. That detail matters for the React, Next.js and Gatsby patterns we cover in the companion post.
Assistants are sessions, not prompts
Instead of rebuilding a prompt for every call, you create an assistant session once: a model, a role, instructions, an optional JSON Schema and a memory switch. Every generate() call then speaks in typed inputs and outputs. The example uses text, but the same shape carries images, audio, video and document passages.
const assistant = await api.models.create({
model: "gemini-3.5-flash",
settings: {
role: "Senior release engineer",
instructions: "Answer in three short bullet points.",
},
schema: {
type: "object",
properties: {
summary: { type: "string" },
risks: { type: "array", items: { type: "string" } },
},
},
memory: true,
})
const first = await assistant.generate({
inputs: [{ type: "text", content: "Summarise the changes shipped in v2.4.0." }],
})
// memory: true keeps the context, so the follow-up can stay short
const followUp = await assistant.generate({
inputs: [{ type: "text", content: "Which risk should we fix first?" }],
})
console.log(first.outputs[0].content, followUp.usage.credits)
await assistant.destroy()The server publishes its own price list, and api.catalogue() reads it. An app can show what a call will cost without copying a pricing grid by hand and watching it drift.
Agents with a budget
The part of the alpha we are most excited about is agents. You compose one from model sessions you already own and from built-in tools: web search, page fetching, screenshots, document conversion, and image, video, voice or music generation. The object key is the name the model sees.
Two guard-rails are built in. maxSteps caps the loop, and budget caps the credits. The budget is checked before a tool is called, against costs we measured in production rather than prices we assumed, so a run stops before it overspends instead of after.
import { IaGenify, NotEnoughCredits } from "iagenify"
const api = new IaGenify({ apiKey: process.env.IAGENIFY_API_KEY })
const main = await api.models.create({ model: "gemini-3.5-flash", memory: false })
const image = await api.models.create({ model: "gemini-2.5-flash-image", memory: false })
const agent = api.agents.create({
model: { main, image },
tools: {
search: api.tools.search,
openPage: api.tools.fetch,
createImage: api.tools.image,
},
maxSteps: 8,
budget: 100,
})
try {
const result = await agent.run({
inputs: [{ type: "text", content: "Find the latest Node.js LTS release and draw a cover image for it." }],
onStep: (step) => console.log("step", step),
signal: AbortSignal.timeout(120_000),
})
console.log(result.text, result.stopReason, result.usage)
} catch (err) {
if (err instanceof NotEnoughCredits) {
console.log(`Need ${err.required} credits, ${err.available} available`)
} else {
throw err
}
} finally {
await agent.destroy()
}Errors keep their type even when they arrive in the middle of a streamed run, so instanceof NotEnoughCredits works the same way for a simple call and for a five-minute agent run.
Hints of what comes next
An alpha is a promise of direction, not a list of dates. Here is where we are pointing the SDK:
- Framework-aware integrations. The client already knows whether it is running inside Next.js, Gatsby or a Vite app. Today that is only a diagnostic; we want it to become the base for first-class integrations.
- Live feedback everywhere. Agent runs already stream their steps as they happen. Bringing the same live feedback to everyday assistant calls is high on the list.
- Storage as memory. Agents can already be connected to IaGenify storage spaces and read their documents. Expect that retrieval layer to become central to how agents remember.
- Models of our own. Our lab is training its first in-house assistant models. The goal is that they arrive through the same
models.create()call as every other model, with no new API to learn.
The alpha is shared with early-access teams while the API settles, and names may still change between releases. If you want to build with it, get in touch, and follow the IaGenify documentation as it grows.
Frequently asked questions
Is the IaGenify SDK available on npm?
Not publicly yet. During the alpha the package is shared with early-access teams, and a public release will follow once the API has stabilised.
Which runtimes does the IaGenify SDK Alpha support?
Node.js, modern browsers and Cloudflare Workers. The SDK detects the runtime and stores its session in a private file, in localStorage or in memory accordingly.
How does the SDK stop an agent from overspending credits?
Each agent has a maxSteps limit and a credit budget. The budget is checked before every tool call against measured tool costs, and a shortfall raises a typed NotEnoughCredits error.
Sources
- IaGenify documentation — IaGenify
- IaGenify — IaGenify
