Init SDK
Official SDK for Init. Generate, deploy, and run backend endpoints in seconds, with compute, storage, and database included.
Init turns a prompt into a deployed API endpoint with a route, schema, runtime, and version history. Describe the inputs, outputs, and behavior you want. Init builds the endpoint and returns a URL you can call immediately.
Use this SDK to generate endpoints, run them, edit versions, manage resources, upload files, and automate recurring tasks.
Install
npm install @init-computer/sdk
Create a client
import { createClient } from "@init-computer/sdk";
const init = createClient({
apiKey: process.env.INIT_API_KEY,
});
You can also set INIT_API_KEY in the environment and call createClient() with no arguments.
Generate an endpoint
Use init.generate() to create a new deployed endpoint from a description. Be specific about the input fields, output fields, storage behavior, and any external work the endpoint should perform.
Project suites
const project = await init.project.generate({ name: "Customer Support", prompt: "Build ticket intake and status lookup." });
await init.project.edit(project.project.id, { prompt: "Add ticket assignment." });
const api = await init.generate({
prompt: `
Create a lead enrichment API for B2B sales teams.
Input fields:
- companyName: string, required
- website: url, required
- targetPersona: string, optional
Output fields:
- companySummary: string
- buyingSignals: array of objects with title, evidence, and urgency
- recommendedPersonas: array of objects with role, reason, and outreachAngle
- nextSteps: array of strings
Behavior:
- Research the company from public web context.
- Prioritize signals related to growth, hiring, product launches, funding, and technology changes.
- Store each generated brief so it can be reviewed later.
- Return structured JSON only.
`,
directories: ["Sales"],
});
console.log(api.result.url);
console.log(api.result.inputStructure);
console.log(api.result.outputStructure);
The response includes the live URL, route, resource ID, version, input schema, output schema, and generated pipeline.
Save the resourceId if you want to inspect, edit, organize, or automate the endpoint later.
Run an endpoint
Use init.run() to call a generated endpoint. You can pass a bare route, a /v1/... path, or the full URL returned from generate.
const response = await init.run(api.result.url, {
companyName: "Snowflake",
website: "https://www.snowflake.com",
targetPersona: "VP Sales",
});
console.log(response.result.buyingSignals);
The request body should match the input fields you asked Init to create. The response follows the output shape from the generated endpoint.
Edit an endpoint
Use resource.edit() to change an existing endpoint. Init keeps the same resource and creates a new version.
const edited = await init.resource.edit(api.result.resourceId, {
prompt: `
Keep the same lead enrichment behavior, but add:
- csv: string, a CSV version of the recommendedPersonas array
- confidenceScore: number from 0 to 1
`,
});
console.log(edited.result.url);
Then call the new version URL returned by the edit response, or inspect versions with init.resource.versions().
Work with files
Generated endpoints can accept multipart input when the endpoint needs uploaded files.
const form = new FormData();
form.append("file", reportFile);
form.append("summaryStyle", "executive");
const report = await init.run("quarterly-report-reader", form, {
requestFormat: "multipart/form-data",
});
console.log(report.result);
Manage resources
Resources are the APIs you have generated.
await init.resource.list({ q: "lead" });
const resource = await init.resource.get(api.result.resourceId);
await init.resource.update(api.result.resourceId, {
name: "Lead Enrichment",
status: "enabled",
});
const versions = await init.resource.versions(api.result.resourceId);
await init.resource.activateVersion(api.result.resourceId, "version_uuid");
Organize with directories
Directories group related endpoints.
const directory = await init.directory.create({
name: "Sales Workflows",
description: "Prospecting, enrichment, and outbound APIs",
});
await init.directory.addResources(directory.result.directory.id, [
api.result.resourceId,
]);
Automate with daemons
Daemons run an endpoint on a schedule or on demand.
const daemon = await init.daemon.create({
resource_id: api.result.resourceId,
input: {
companyName: "Snowflake",
website: "https://www.snowflake.com",
},
interval_seconds: 86400,
max_runs: 30,
description: "Refresh Snowflake account research daily",
});
await init.daemon.run(daemon.result.daemon.id);
await init.daemon.pause(daemon.result.daemon.id);
await init.daemon.resume(daemon.result.daemon.id);
Discover packages
Packages are the capabilities available to generated endpoints.
A package can be an Init-provided capability, an external app, or one of your own tools. Packages can give endpoints access to compute, storage, databases, models, APIs, and integrations such as OpenAI, Anthropic, Neon, Supabase, or custom internal services.
Use packages to see what your generated endpoints can connect to and use during execution.
await init.pkg.list({ category: "Database" });
await init.pkg.list({ category: "Model" });
await init.pkg.list({ category: "Integration" });
await init.pkg.list({ enabled_category: "Storage" });
For example, you can generate an endpoint that uses connected packages:
const api = await init.generate({
prompt: `
Create a customer support triage API.
Input fields:
- message: string, required
- customerId: string, optional
Output fields:
- category: string
- priority: string
- summary: string
- suggestedReply: string
- shouldEscalate: boolean
Behavior:
- Use the connected Anthropic package to classify and summarize the request.
- Use the connected Supabase package to store the support ticket.
- Return structured JSON only.
`,
});
Once your own tools are connected to Init as packages, generated endpoints can call them the same way they call built-in or third-party capabilities.
API surface
init.generate(request);
init.run(route, input, options);
init.resource.list(query);
init.resource.get(id);
init.resource.update(id, patch);
init.resource.edit(id, request);
init.resource.versions(id);
init.resource.activateVersion(id, versionId);
init.directory.list(query);
init.directory.create(input);
init.directory.get(id);
init.directory.update(id, patch);
init.directory.delete(id);
init.directory.addResources(id, resourceIds);
init.directory.removeResource(id, resourceId);
init.daemon.list(query);
init.daemon.create(input);
init.daemon.get(id);
init.daemon.pause(id);
init.daemon.resume(id);
init.daemon.stop(id);
init.daemon.run(id);
init.pkg.list(query);
Errors
Failed requests throw InitApiError.
import { InitApiError } from "@init-computer/sdk";
try {
await init.run("missing-route", {});
} catch (error) {
if (error instanceof InitApiError) {
console.log(error.status);
console.log(error.details);
}
}
Common status codes:
402: Plan limit reached. Upgrade your plan or enable overages.
429: Too many concurrent requests. Retry after current runs finish.
500: Internal server error. The public response is intentionally broad.
503: Init or Cloudflare platform service is temporarily unavailable.