Run an offline model call through the public Node.js SDK using the bundled catalog and a sample response. You only need Node.js and npm; no provider key or paid service is required.
Use Node.js 24.20.0 to match the tested environment. In a new directory, run:
npm init -y
npm install --save-exact --ignore-scripts @techis/ai-runtime@0.4.0 @techis/ai-contracts@0.4.0
npm ls @techis/ai-runtime @techis/ai-contracts
Both versions should be 0.4.0. Keep the generated lockfile and use npm ci --ignore-scripts to restore its dependency versions.
Save this as quickstart.mjs. The selected catalog ID is present in the installed preview. The supplied transport intercepts the request before any network call.
import { createModelRun, getInstalledCatalogDelivery } from "@techis/ai-runtime";
const { catalog } = getInstalledCatalogDelivery().release;
const catalogId = "gpt-5.6-luna";
const model = catalog.models.find(entry => entry.catalogId === catalogId);
if (!model) throw new Error("The selected model is missing from the installed catalog.");
const run = createModelRun({
applicationId: "runtime-quickstart",
catalog,
catalogId,
settings: { defaultMaxOutputTokens: 128 },
systemInstructions: "Keep the answer brief.",
providerConnections: {
openai: { provider: "openai", endpoint: "https://mock.invalid", credentialReference: "quickstart:mock" }
},
credentialResolver: {
async resolve(reference) {
if (reference !== "quickstart:mock") throw new Error("Unexpected credential reference.");
return { kind: "bearer", token: "synthetic-token" };
}
},
async fetchImpl(url, init) {
const request = JSON.parse(String(init.body));
if (new URL(url).hostname !== "mock.invalid" || request.model !== model.providerModelId) {
throw new Error("Unexpected provider request.");
}
return Response.json({
id: "response-local",
model: request.model,
created_at: 0,
status: "completed",
output: [{
id: "message-local",
type: "message",
role: "assistant",
status: "completed",
content: [{ type: "output_text", text: "Hello from the local fixture.", annotations: [] }]
}],
usage: { input_tokens: 8, output_tokens: 6 }
});
}
});
const result = await run.responses.create({ input: "Say hello." }, { operationId: "quickstart.hello" });
if (result.outcome !== "completed") throw new Error(result.outcome);
console.log(result.output_text);
console.log(result.executionReceipt.kind);
node quickstart.mjs
The output is Hello from the local fixture. followed by direct-model-execution-receipt. Direct execution pins one model and settings for one attempt. Use a Route when you need a saved selection or ordered backups.
Choose an exact catalogId for a model your provider account can access. List the installed OpenAI entries with the command below. A catalog entry records known metadata. Check current model access and pricing with your provider before making a live request.
node --input-type=module -e "import {getInstalledCatalogDelivery as get} from '@techis/ai-runtime'; console.table(get().release.catalog.models.filter(m => m.provider === 'openai').map(m => ({id: m.catalogId, model: m.providerModelId})))"
For OpenAI, omit endpoint from the openai connection to use the adapter default, https://api.openai.com/v1/responses. Set the credential reference to a host-owned value such as env:OPENAI_API_KEY. Update the resolver to check that reference and return { kind: "bearer", token } using the value from your secret store or process environment. Throw if the key is absent. Remove the mock fetchImpl to use the real transport. Check the model's settings and set your own deadline and cancellation policy. Running the script with a real connection makes a provider request and may incur charges.
Integrate an application ยท Runtime API and adapters ยท Documentation index