VisibleBase
Quickstart

Add Model

Store models as database data, then route provider differences inside services with `match()`.

VisibleBase keeps models in the database now. They are no longer handwritten runtime registrations.

The minimum fields are:

  • model_id
  • name
  • provider
  • upstream_model
  • description
  • is_primary
  • status
  • config_json

Example for the default SQLite database:

import { DatabaseSync } from "node:sqlite";
import path from "node:path";

const db = new DatabaseSync(path.join(process.cwd(), ".base", "visiblebase.sqlite"));

db.prepare(`
  INSERT OR REPLACE INTO visiblebase_models (
    model_id,
    name,
    provider,
    upstream_model,
    description,
    is_primary,
    status,
    config_json,
    created_at,
    updated_at
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`).run(
  "gpt-5.4",
  "GPT-5.4",
  "openai",
  "gpt-5.4",
  "Primary text model",
  "true",
  "active",
  JSON.stringify({ api_style: "responses" }),
  new Date().toISOString(),
  new Date().toISOString(),
);

Then define the service routing in Base:

base.text()
  .default({ model: "gpt-5.4" })
  .match((ctx) => ctx.model.provider === "openai", async (ctx) => {
    return openai.responses.create({
      model: ctx.model.upstream_model,
      input: ctx.query.prompt,
      apiKey: ctx.env.OPENAI_API_KEY,
      baseURL: ctx.env.OPENAI_BASE_URL,
    });
  });

The client only needs to know the stable model ID gpt-5.4. It does not need to know how Base calls the real provider.