Skip to content

Your first model

Create a namespace before creating a model. In Compute → Models, create a model with code support, select its namespace, then replace the starter source with this executor.

first-model.ts
import type { Executor } from "@neutrome/lilsdk";
const upstream = "default/gpt-oss-20b";
const executor: Executor = {
async execute(request, ctx) {
return ctx.invoke(upstream, request);
},
async *stream(request, ctx) {
yield* ctx.invokeStream(upstream, request);
},
};
export default executor;

ctx.invoke() serves non-streaming calls. ctx.invokeStream() serves streaming calls. Both receive the normalized request program and invoke the target model or provider through the managed runtime.

default/gpt-oss-20b is a built-in managed model, so this first model works without provider setup. Save, deploy, then test the model from the editor.

Later, replace it with an ID from the built-in provider catalog or <provider-code>/<provider-model> after you connect an upstream provider.

Model editor showing TypeScript executor source

For executor types and runtime context details, use the SDK reference.