StackNet Integration
LODE is integrated into StackNet’s model registry as the encoding format for model layer distribution.
Registry Endpoint
GET /v1/registry/layers/:name/veinThis endpoint:
- Loads the model layer by name from the registry
- Loads the
model-layer-v1.lodeschema - Compiles the layer to Vein binary using
compile() - Computes the fingerprint using
fingerprint() - Returns the binary with metadata headers
Response:
Content-Type: application/x-vein
X-Lode-Fingerprint: a3f8c2e9...
<binary payload>Model Layer Definition
A model layer describes a pool of AI models available for a given tier:
interface ModelLayer {
name: string; // e.g. "preview", "fast", "turbo"
isDefault: boolean; // Default for bare aliases
models: string[]; // Pool of canonical model IDs
defaultModel: string; // Default from the models pool
defaults?: Record<string, string>; // Per-capability overrides
}Example:
{
"name": "preview",
"isDefault": true,
"models": ["gpt-oss:20b", "qwen3:30b", "qwen3:8b", "qwen3-coder:30b", "devstral:24b"],
"defaultModel": "gpt-oss:20b",
"defaults": {
"code": "qwen3-coder:30b",
"embed": "nomic-embed-text",
"vision": "qwen3-vl:30b"
}
}Client-Side Verification
Clients receiving Vein payloads can verify integrity using the fingerprint header:
const res = await fetch(`${registryUrl}/v1/registry/layers/preview/vein`);
const vein = new Uint8Array(await res.arrayBuffer());
const expectedHash = res.headers.get("X-Lode-Fingerprint");
const schema = loadLode("model-layer-v1.lode");
const ok = verify(vein, expectedHash, schema);
if (ok) {
const layer = decode(vein, schema);
// Use the verified layer data
}Prompt Contracts
While prompt contracts are defined as TypeScript interfaces rather than .lode schema files, they follow the same trust model. Every inference request is wrapped in a PromptContract that establishes:
- A token budget (hard ceiling)
- Estimated inbound cost (from request measurement)
- Maximum possible cost (inbound + ceiling)
- Affordability check (balance vs. worst-case cost)
The contract enforcer validates affordability before the request reaches the model — if the caller cannot cover the worst-case cost, the request is rejected with HTTP 402.
const contract = await buildPromptContract({
auth: { userId, ownerId },
body: requestBody,
inboundUsage: measuredUsage,
contentType: "code",
taskType: "coder-session",
model: "qwen3-coder:30b",
accountBalanceManager,
});
const rejection = enforcePromptContract(contract);
if (rejection) return rejection; // 402 Insufficient BalanceLast updated on