Skip to content

VIP-62: Experimental.Model: language models and decision models with no SDK

Status: accepted by Will, 2026-11-23 — standard library only (no compiler or language changes). Will: "58 I accept. I accept every other language proposal but ones that don't require a change to the language and are purely library functions that don't require compiler changes at all should be marked as such". Implemented in the runtime as Experimental.Model.

Will's words

Vibelang is meant to have most of the features of durable execution agents etc. built into it. What is that status? Are the VIP open or are VIP missing for things like adding llm calls or jev calls to language sandboxing durable execution etc?

Ok so give me a list of [the reference engine's] features. We need to figure out what the VIP should look like. Some of the features outside of durable execution likely should simply be in the standard library I'm guessing but we should enumerate all of them

Summary

VIP-33 also applies: "Make sure you do NOT implement anything that is already in effect."

One sentence. A Vibe program calls a model through Effect's LanguageModel and DecisionModel, which are already in scope, and one new module, Experimental.Model, turns a string such as "anthropic:claude-sonnet-5-5" into the layer that serves them.

One paragraph. Vibe 0.0.13 already has the calling half. LanguageModel.generateText, generateObject and streamText, DecisionModel.decide, Decision, EmbeddingModel, Chat, Tool and Toolkit are Effect modules in scope with no import. Effect also publishes the provider half, as packages with no vendor SDK and no dependencies: @effect/ai-anthropic, @effect/ai-openai and @effect/ai-openai-compat. What is missing is everything between a program and those packages: one string that names a model, a key that never enters the program, a record of each call inside a durable step, a quota that parks a run, and Jev, which Will calls "jev calls". Experimental.Model adds those. It bundles Effect's provider packages, so a program installs nothing, and it takes from the model package of the reference engine (an existing Effect durable-execution framework these built-ins are modelled on) only what Effect lacks.

 your code                         interface (Effect, in scope today)      provider
 ─────────                         ──────────────────────────────────      ────────
 LanguageModel.generateObject ──►  LanguageModel  ◄── Model.use("anthropic:claude-sonnet-5-5") ──► @effect/ai-anthropic
 LanguageModel.streamText     ──►                 ◄── Model.use("openai:gpt-6.1-sol")          ──► @effect/ai-openai
                                                  ◄── Model.compatible({ baseUrl, model })     ──► @effect/ai-openai-compat
 DecisionModel.decide         ──►  DecisionModel  ◄── Model.decide()                           ──► Jev, through the reference engine's Evaluator

Decision

// proposed
schema Label { type: "bug" | "feature" | "question" | "chore" }
 
export effect function label(title: string) {
  const reply = try LanguageModel.generateObject({ prompt: `Label this issue: ${title}`, schema: Label })
  return reply.value
}
 
export effect function demo() {
  provide Experimental.Model.use("anthropic:claude-sonnet-5-5") {
    try Console.log(try label("Crash on start"))
  }
}

A decision model answers typed questions about one input in one call:

// proposed
schema Issue { title: string; body: string }
 
const Triage = Decision.make({
  input: Issue,
  decisions: {
    kind: Decision.classify({
      instructions: "What kind of issue is this?",
      criteria: { bug: "Something is broken", feature: "A request for new behavior", question: null }
    }),
    urgency: Decision.rate({ instructions: "How urgent is it?", criteria: ["low", "medium", "high"] })
  }
})
 
export effect function triage(issue: Issue) {
  provide Experimental.Model.decide() {
    return try DecisionModel.decide(Triage, { input: issue })
  }
}

Only Experimental.Model is new in both examples.

Module

Experimental.Model, in scope with no import and named after the Effect module it extends, effect/ai's Model: a layer that carries its provider's name. Its code is vibelang-runtime/experimental/Model. A bare Model stays EK1401 in Vibe, because Effect exports it from two subpaths.

CallProvidesBuilt on
Model.use(seat)LanguageModelEffect's AnthropicLanguageModel.model, OpenAiLanguageModel.model and their layerConfig clients
Model.use([seatA, seatB])LanguageModel, falling back in orderThe reference engine's ordered seat list (agent/README.md)
Model.compatible({ id, baseUrl, model, apiKey?, protocol? })LanguageModel from any OpenAI-compatible server@effect/ai-openai-compat
Model.decide(seat?)DecisionModel. With no argument, JevThe reference engine's Evaluator.layerVercelGateway, EvaluatorBackup.fromModel
Model.embed(seat)EmbeddingModelEffect's OpenAiEmbeddingModel.model
Model.proxy(options) and Model.proxied({ url })An HTTP handler that serves a model, and a LanguageModel that calls itThe reference engine's ModelProxy.serve, ModelProxy.layerClient
Model.contextWindow(modelId), Model.cost(usage, modelId)Catalog facts and USD costThe reference engine's ModelCatalog, Pricing

Rules

  1. A seat is a string, provider:modelId. It holds no key and no endpoint, so it is safe in source and in a plan.
  2. Keys come from Config. Model.use("anthropic:…") reads ANTHROPIC_API_KEY as a redacted config value inside the layer. .vibe code has no process.env, and a key never enters a request's recorded form.
  3. An unknown seat fails when the layer is built, with Model.ModelUnresolved, not halfway through a run.
  4. protocol matters. Responses and Chat Completions are different wire formats. "chat" is the default for Model.compatible, because Ollama, Cerebras, Gemini's compatibility layer and most self-hosted servers speak it. "OpenAI-compatible" names a wire family; it does not promise every server accepts every option.
  5. Structured output is Effect's. generateObject takes a schema. A provider that enforces JSON Schema gets it, and the answer is still decoded locally. A miss fails with AiError.
  6. Inside a task, a call is a recorded step. A resumed run reads the recorded answer and usage. A crash before the call is recorded can call the provider again: delivery is at-least-once, and a streamed prefix is not a record.
  7. A model answer is never shared across runs. It is memoized for its run only.
  8. Retries do not multiply. The provider client retries transport faults within a bound. Inside a task that declares a retryPolicy, the client's own retry is off, so one layer retries one failure.
  9. A quota parks. A provider refusal that names a reset time parks a durable run until then instead of failing it (the reference engine's QuotaPolicy).
  10. A decision is evidence, not permission. An unreachable decision model fails; it never answers yes. A fallback to a language model is opt-in, and the record says which answered.
  11. A browser holds no key. It provides Model.proxied({ url }), and a server mounts Model.proxy.
  12. The permission is model:call. Under capabilities, a model request needs it.

Replay in the runtime

A model call, stream or decision made inside a durable task gets its own journal entry. Its key uses the task's replay identity and retry attempt, the request digest and the occurrence within the enclosing named race. Equal prompts in separate races or task attempts can produce different answers. Recovery reuses each call's own recorded answer.

What must be built

  • Seat resolution and bundling. A table from provider name to Effect's package, shipped with vibelang-runtime at the pinned Effect version (VIP-32).
  • Recording. The reference engine records a model call in ModelStep.run, over its own Model.stream events. The port records at Effect's LanguageModel service instead, so any provider is recorded the same way.
  • DecisionModel over the reference engine's Evaluator. No adapter exists at main@origin bcf8076a4ff4. The two have the same shape: one JSON state and a map of typed questions out, one typed answer per question back. It is DecisionModel.make({ decide }).

Host needs

HttpClient only. The module runs on Node, Bun, a Cloudflare Worker and in a browser.

Maintainers' decisions

This record comes from the 2026-11-09 built-in set review. The Status line above records Will’s subsequent ruling.

  • A decision model answers typed questions about one input in one call: Design · Review.
  • Only Experimental.Model is new in both examples. Design · Review.
  • Experimental.Model, in scope with no import and named after the Effect module it extends, effect/ai's Model: a layer that carries its provider's name. Design · Review.
  • Its code is vibelang-runtime/experimental/Model. Design · Review.
  • A bare Model stays EK1401 in Vibe, because Effect exports it from two subpaths. Design · Review.
  • Call Model.use(seat): Provides: LanguageModel; Built on: Effect's AnthropicLanguageModel.model, OpenAiLanguageModel.model and their layerConfig clients. Design · Review.
  • Call Model.use([seatA, seatB]): Provides: LanguageModel, falling back in order; Built on: the reference engine's ordered seat list (agent/README.md). Design · Review.
  • Call Model.compatible({ id, baseUrl, model, apiKey?, protocol? }): Provides: LanguageModel from any OpenAI-compatible server; Built on: @effect/ai-openai-compat. Design · Review.
  • Call Model.decide(seat?): Provides: DecisionModel. With no argument, Jev; Built on: the reference engine's Evaluator.layerVercelGateway, EvaluatorBackup.fromModel. Design · Review.
  • With no argument, Jev | The reference engine's Evaluator.layerVercelGateway, EvaluatorBackup.fromModel | Design · Review.
  • Call Model.embed(seat): Provides: EmbeddingModel; Built on: Effect's OpenAiEmbeddingModel.model. Design · Review.
  • Call Model.proxy(options) and Model.proxied({ url }): Provides: An HTTP handler that serves a model, and a LanguageModel that calls it; Built on: the reference engine's ModelProxy.serve, ModelProxy.layerClient. Design · Review.
  • Call Model.contextWindow(modelId), Model.cost(usage, modelId): Provides: Catalog facts and USD cost; Built on: the reference engine's ModelCatalog, Pricing. Design · Review.
  • A seat is a string, provider:modelId. Design · Review.
  • It holds no key and no endpoint, so it is safe in source and in a plan. Design · Review.
  • Keys come from Config. Model.use("anthropic:…") reads ANTHROPIC_API_KEY as a redacted config value inside the layer. Design · Review.
  • .vibe code has no process.env, and a key never enters a request's recorded form. Design · Review.
  • An unknown seat fails when the layer is built, with Model.ModelUnresolved, not halfway through a run. Design · Review.
  • protocol matters. Responses and Chat Completions are different wire formats. Design · Review.
  • "chat" is the default for Model.compatible, because Ollama, Cerebras, Gemini's compatibility layer and most self-hosted servers speak it. Design · Review.
  • "OpenAI-compatible" names a wire family; it does not promise every server accepts every option. Design · Review.
  • Structured output is Effect's. generateObject takes a schema. Design · Review.
  • A provider that enforces JSON Schema gets it, and the answer is still decoded locally. Design · Review.
  • A miss fails with AiError. Design · Review.
  • Inside a task, a call is a recorded step. A resumed run reads the recorded answer and usage. Design · Review.
  • A crash before the call is recorded can call the provider again: delivery is at-least-once, and a streamed prefix is not a record. Design · Review.
  • A model answer is never shared across runs. It is memoized for its run only. Design · Review.
  • Retries do not multiply. The provider client retries transport faults within a bound. Design · Review.
  • Inside a task that declares a retryPolicy, the client's own retry is off, so one layer retries one failure. Design · Review.
  • A quota parks. A provider refusal that names a reset time parks a durable run until then instead of failing it (the reference engine's QuotaPolicy). Design · Review.
  • A decision is evidence, not permission. An unreachable decision model fails; it never answers yes. Design · Review.
  • A fallback to a language model is opt-in, and the record says which answered. Design · Review.
  • A browser holds no key. It provides Model.proxied({ url }), and a server mounts Model.proxy. Design · Review.
  • The permission is model:call. Under capabilities, a model request needs it. Design · Review.
  • Seat resolution and bundling. A table from provider name to Effect's package, shipped with vibelang-runtime at the pinned Effect version (VIP-32). Design · Review.
  • Recording. The reference engine records a model call in ModelStep.run, over its own Model.stream events. Design · Review.
  • The port records at Effect's LanguageModel service instead, so any provider is recorded the same way. Design · Review.
  • DecisionModel over the reference engine's Evaluator. No adapter exists at main@origin bcf8076a4ff4. Design · Review.
  • The two have the same shape: one JSON state and a map of typed questions out, one typed answer per question back. Design · Review.
  • It is DecisionModel.make({ decide }). Design · Review.
  • HttpClient only. Design · Review.
  • The module runs on Node, Bun, a Cloudflare Worker and in a browser. Design · Review.

Adopted review answers

  • Keep Experimental.X names under VIP-33. Promotion to a bare module name requires a later decision. Review question 1.
  • Effect's provider packages call model providers. The reference engine supplies the composition above them. Review decision.

Compared

The first example in the reference engine 1.x. It type-checks against the reference engine's model package 1.0.0-rc.16.

import { Model, ModelEvent, ModelRequest, RequestExecutor, Route } from "@smthrs/model"
import { Effect, Layer, Redacted, Result, Schema, Stream } from "effect"
import * as FetchHttpClient from "effect/http/FetchHttpClient"
 
const Label = Schema.Struct({ type: Schema.Literals(["bug", "feature", "question", "chore"]) })
 
export const label = (title: string) =>
  Effect.gen(function*() {
    const model = yield* Model.Model
    const events = yield* Stream.runCollect(model.stream(ModelRequest.ModelRequest.make({
      modelId: "claude-sonnet-5-5",
      system: [],
      messages: [ModelRequest.Message.user(`Label this issue as JSON {"type": "bug" | "feature" | "question" | "chore"}: ${title}`)],
      tools: [],
      params: ModelRequest.GenerationParams.make({ maxTokens: 256 })
    })))
    const { message } = ModelEvent.settledMessage(events)
    const text = message.content.flatMap((part) => part.type === "text" ? [part.text] : []).join("")
    return yield* Schema.decodeEffect(Schema.fromJsonString(Label))(text)
  })
 
export const layer = (apiKey: string) =>
  Route.layer(Result.getOrThrow(Route.anthropic({ apiKey: Redacted.make(apiKey) }))).pipe(
    Layer.provide(RequestExecutor.layer),
    Layer.provide(FetchHttpClient.layer)
  )
ProgramTokens (o200k_base)Lines
Label one issue: Vibe, proposed10112
Label one issue: Vibe 0.0.13 today, importing @effect/ai-anthropic15219
Label one issue: reference engine 1.x31726
Classify and rate one issue with Jev: Vibe, proposed13618
Classify and rate one issue with Jev: reference engine 1.x19919

Today's program replaces the provide line with Layer.provide(AnthropicLanguageModel.model("claude-sonnet-5-5"), AnthropicClient.layerConfig({ apiKey: Config.Redacted("ANTHROPIC_API_KEY") })) and one import. The Jev twin in the reference engine uses Classifier.make, Classifier.choice, Classifier.score and Evaluator.layerVercelGateway.

Checked. Both proposed examples use only existing syntax and compile under vibelang 0.0.13 against a declaration of Experimental.Model; every LanguageModel, Decision and DecisionModel call resolves to Effect 4.1.1 with no import. Today's program compiles under vibelang 0.0.13 against @effect/ai-anthropic 4.1.1, whose peer is effect ^4.1.1 and which has no dependencies. Both reference engine programs type-check as shown.

Principles

  • TypeScript-first. Function calls. A seat is a string.
  • Effect-second. The interface is Effect's and so is the provider code. This VIP adds only what Effect has no module for.
  • Optimized for agentic programs. Model calls should be as straightforward as HTTP and file operations. Here a model call is one line and one provide, and a replay does not pay twice.
  • Highly forkable. A fork adds a provider by adding a row to one table. Model.compatible covers most without a fork.
  • Factory-first. Every model call the factory makes goes through this module and lands in a journal.

What this changes

  • Experimental.Model is new. No grammar changes.
  • vibelang-runtime bundles three Effect provider packages. The home page's "No AI SDK needed" becomes true for Anthropic, OpenAI and OpenAI-compatible servers.
  • One adapter and one recorder are written, as listed above.

Alternatives

  • The reference engine's routes as the provider code, behind Effect's interface. The reference engine's model package has routes for Anthropic Messages, OpenAI Responses and both OpenAI-compatible protocols, and one retry path. It would be a second implementation of what Effect ships, which VIP-33 forbids in Will's words. It also cannot run today: the published reference engine requires effect 4.0.5. See open question 1.
  • Expose the reference engine's Model.stream as the interface. It is a stream of events with no structured output and no tool resolution. Effect already wrote the higher interface.
  • A model keyword or a prompt literal. Nothing here needs the compiler.
  • Seats as values, Model.anthropic("claude-sonnet-5-5"). Typed, and it cannot be read from a config file or a markdown header. A string can.

Follow-up questions

  1. Provider code (decided). Effect's packages are the provider implementation; the reference engine supplies the higher-level composition. See the Maintainers' decisions section.
  2. Is Jev the default decision model? Model.decide() with no argument reaches Jev through the Vercel AI Gateway and needs AI_GATEWAY_API_KEY. Recommendation: yes, with Model.decide(seat) as the explicit alternative.
  3. Subscription seats. The reference engine can serve a seat from a signed-in Claude Code or Codex subscription (OpenAIChatGPT). Should a language's standard library read another product's login? Recommendation: no. Keep it in the reference engine and let it provide the layer.
  4. Prompt. Effect's Prompt is ambiguous in Vibe (effect/ai and effect/cli), so building a multi-message prompt needs an import today. Should effect/ai win in scope? Recommendation: yes; it belongs in VIP-14's precedence table.

Depends on

  • std-durable: recorded calls inside a task. Outside a task the module needs nothing in this set.
  • capabilities: model:call.