Base 3:16
Getting started

Build with an agent

Let Claude Code, Cursor or any coding agent set Base316 up and use it.

A coding agent can take an application from no Base316 account details at all to a working sandbox in three commands. The only human step is approving the sign-in once, in a browser.

1. Sign in — the one step a person does

An agent's terminal output reaches you only after a command finishes, so sign-in is split in two. The agent runs:

npx @base316/cli login --no-wait
To sign in, open:
  https://app.base316.com/device?user_code=ABCDEFGH

and check the page shows the code ABCD-EFGH.

Then run `npx @base316/cli login` again to finish.

Open the link, check the code matches, and press Approve. The agent then runs npx @base316/cli login, which picks up the approval.

Approve only a code you or your agent just asked for. The session it creates can do anything you can do in the dashboard. Nobody from Base316 will ever ask you for one.

At a terminal yourself, plain npx @base316/cli login does both halves and opens the browser for you.

The session is stored owner-only in ~/.config/base316/credentials.json. npx @base316/cli logout revokes it on the server as well as deleting it, and it appears under Settings → Security → Active sessions like any other sign-in.

2. Set up the project

npx @base316/cli init --project "My App"
Created project "My App" in Acme.
Wrote sandbox keys to .env: BASE316_SECRET_KEY, BASE316_PUBLISHABLE_KEY, NEXT_PUBLIC_BASE316_PUBLISHABLE_KEY.
Added .env to .gitignore.
  • A project that already has that name is reused, with a fresh sandbox secret key named for the machine — secret keys are shown once and cannot be read back.
  • Only Sandbox keys are written. Nothing init does can reach live customers.
  • An .env that already has BASE316_SECRET_KEY is left alone unless you pass --force.
  • In more than one workspace, init lists them and asks for --workspace.
  • Creating a project needs an owner or admin of the workspace, and counts against the plan's project limit, exactly as it does in the dashboard.

The key itself is never printed, so it stays out of the agent's transcript.

3. Give the agent the tools

claude mcp add base316 -- npx -y @base316/mcp

Run from the project directory, the MCP server reads the key init wrote, so no key goes into the agent's own configuration. The CLI reads it the same way:

npx @base316/cli whoami
npx @base316/cli plans

4. Tell the agent the rules

Paste this into the application's AGENTS.md or CLAUDE.md. Each line is a mistake an agent makes without it.

## Base316

- Keys live in `.env` (written by `npx @base316/cli init`). `BASE316_SECRET_KEY` is
  server-only — never import it into client code. Browsers get `BASE316_PUBLISHABLE_KEY`.
- Gate work **before** doing it: `await base316.access.check({ externalId, feature, requested })`,
  and refuse when `allowed` is false. Do not bill afterwards for work that should have been refused.
- Record usage **after** the work succeeds: `await base316.events.record({ externalId, event,
idempotencyKey, payload })`. `idempotencyKey` is required — use the request id, so a retry
  never bills twice.
- Work in Sandbox. Test renewals, trials and dunning with test clocks
  (`npx @base316/cli clock:advance <date>`) instead of waiting for them.
- Check what a key points at with `npx @base316/cli whoami`, and why a customer was refused with
  `npx @base316/cli check <customer> <feature>`.
- The API describes itself at https://api.base316.com/llms.txt and /openapi.json.

Where agents find Base316

ResourceFor
/llms.txtThe API, summarised for a model
/openapi.jsonEvery operation, with its schemas
Docs llms-full.txtThese docs as one file
@base316/mcpTools an agent calls directly
@base316/cliChecks an agent runs from a shell

On this page