Typed access
Use Tenzarch and TenzarchError exports from @tenzarchsdk/sdk.
The Tenzarch SDK is the typed server-side interface to the Tenzarch Developer Platform for discovering AI Executions, submitting workloads, tracking Jobs, inspecting logs and telemetry, and reading usage data.
The Tenzarch SDK is the typed server-side interface to the Tenzarch Developer Platform. It wraps authentication, AI Execution discovery, execution submission, Jobs, pagination, logs, telemetry, usage, idempotency, retries, cancellation, and structured errors while preserving the backend as the source of truth.
Use Tenzarch and TenzarchError exports from @tenzarchsdk/sdk.
Discover AI Executions, submit workloads, persist Job references, and track lifecycle state.
Read logs, telemetry, usage, and metrics through Developer Platform routes.
Use Idempotency-Key, AbortSignal, retries, pagination, and structured errors intentionally.
Node.js >=18.
A Tenzarch developer API Key.
The Tenzarch API base URL for the environment you are integrating with.
A backend/server runtime, not browser JavaScript.
npm install @tenzarchsdk/sdkCurrent package version: 0.1.0. This is the intended installation command for the published package; confirm publication status in your package registry before using it in production installs.
import { Tenzarch } from "@tenzarchsdk/sdk";
const tenzarch = new Tenzarch({
apiKey: process.env.TENZARCH_API_KEY!,
baseUrl: process.env.TENZARCH_API_URL!,
timeoutMs: 30_000,
maxRetries: 2,
});Optional constructor values are timeoutMs, maxRetries, and fetch. The SDK automatically sends x-api-key on requests.
const services = await tenzarch.services.list();
for (const service of services) {
console.log(service.serviceId, service.name, service.creditCost);
}/api/marketplace/servicesLists AI Executions available for integration.
const job = await tenzarch.services.execute(
"code-gen",
{
prompt: "Generate a TypeScript utility for validating execution payloads.",
language: "typescript",
},
{ idempotencyKey: crypto.randomUUID() }
);
console.log(job.jobId, job.workflowRunId, job.status);{
"input": {
"prompt": "Generate a TypeScript utility for validating execution payloads.",
"language": "typescript"
}
}/api/marketplace/services/:id/executeCreates an execution from an AI Execution capability.
For supported workload creation requests, the SDK sends Idempotency-Key when options.idempotencyKey is provided. The SDK does not invent local idempotency; it passes the key to the backend.
The backend can replay the existing response instead of creating another workload.
The backend can reject the request with IDEMPOTENCY_CONFLICT.
const job = await tenzarch.jobs.create(
{
type: "developer_job",
payload: { prompt: "Summarize this report." },
},
{ idempotencyKey: crypto.randomUUID() }
);const result = await tenzarch.jobs.list({
page: 1,
limit: 20,
status: "completed",
serviceId: "code-gen",
dateFrom: new Date("2026-01-01T00:00:00.000Z"),
dateTo: new Date(),
});
console.log(result.data);
console.log(result.pagination);jobs.list() returns { data, pagination }. Do not flatten pagination; persist and display it explicitly when building developer tooling.
const job = await tenzarch.jobs.get("job_123");
const completedOrFailed = await tenzarch.jobs.wait("job_123", {
timeoutMs: 120_000,
intervalMs: 1_500,
});jobs.wait() is SDK-side polling. It is not a backend endpoint. It repeatedly calls jobs.get() until the Job status is completed or failed, or until timeoutMs is reached.
const logs = await tenzarch.jobs.logs("job_123");
const telemetry = await tenzarch.jobs.telemetry("job_123", {
page: 1,
limit: 50,
});
console.log(telemetry.data);
console.log(telemetry.pagination);jobs.telemetry() returns { data, pagination }. Logs return ExecutionLog[]. Telemetry access should use the telemetry:read scope when enforced for the mounted backend route.
const usage = await tenzarch.usage.get({
periodStart: "2026-01-01T00:00:00.000Z",
periodEnd: new Date(),
});
const metrics = await tenzarch.usage.metrics();The current metrics method calls GET /api/developers/metrics and returns the same UsageSummary shape as usage.get(). Do not document a separate metrics schema unless the backend introduces one.
const controller = new AbortController();
const promise = tenzarch.jobs.wait("job_123", {
signal: controller.signal,
});
controller.abort();The SDK retries transient failures: 429, 502, 503, 504, and network errors.
timeoutMs defaults to 30000 for HTTP requests, maxRetries defaults to 2, jobs.wait() defaults to 120000 timeoutMs and 1500 intervalMs.
Structured errors expose status, code, message, requestId, retryAfterSeconds, and response.
import { TenzarchError } from "@tenzarchsdk/sdk";
try {
await tenzarch.services.execute("code-gen", input, {
idempotencyKey: crypto.randomUUID(),
});
} catch (error) {
if (error instanceof TenzarchError) {
console.error(error.status, error.code, error.requestId);
}
throw error;
}SDK type support exists, but the current service-list route is public; do not claim this scope is required for that route unless the backend enforces it.
Required for executing AI Executions when scope enforcement is enabled.
Used for Job history and Job detail access where enforced.
Used for telemetry access where enforced.