openlayer init command is a guided setup flow. It signs you in, creates or links an
Openlayer project, and then sets up
development mode, monitoring, or both — all in your current directory.
Because init creates and links the project itself, the recommended first-run flow is
install → init →
push. You do not need a separate
openlayer login or
openlayer link step.
openlayer init requires Openlayer CLI v1.13.0 or later. Check your
version with openlayer --version and upgrade with openlayer update.Usage
What init does
Every run begins with the same three steps, then asks what you want to set up:1
Check repository
init writes and edits files, so it first checks that you are in a Git repository with a
clean working tree. If the working tree has local changes, it lists them and asks whether
to continue. If the directory is not a Git repository at all, it warns you that its edits
will not be easy to revert.2
Sign in
init authenticates you, so you do not need to run openlayer login first. See
Authentication for the order of preference and the on-prem prompt.3
Link project
If the directory is already linked to a project that still exists, this step is skipped.Otherwise
init lists the projects in your workspace and asks whether to link to an
existing one or create a new one. Creating a new project asks for a name (defaulting to
the directory name) and a project type.Either way, init writes .openlayer/config.json with the project and workspace ids and
adds .openlayer to your .gitignore.4
Choose what to set up
Finally,
init asks which track to run — see
Choosing what to set up.init asks whether to retry it, skip it, or quit, so one failed
step does not discard the work already done.
Choosing what to set up
Both runs monitoring before development mode on purpose: the live traces monitoring
captures can later be pulled into development-mode datasets. If you pick a single track,
init offers to continue into the other one when it finishes.
Development mode track
1
Set up evaluations
Choose how your
openlayer.json gets written: with a coding agent that init detects on
your machine (Claude Code or Codex), with a deterministic
starter scaffold, with a prompt copied to your clipboard for your own
coding agent, or manually by following the
openlayer.json guide.Skipped when an openlayer.json already exists.2
Push first commit
Asks before running
openlayer push with the commit
message Initial commit from openlayer init. Skipped when there is no openlayer.json
to push.3
Automate in CI
Optionally writes a starter
.github/workflows/openlayer.yml that pushes to Openlayer on
your pull requests, then reminds you to add OPENLAYER_API_KEY and OPENLAYER_PROJECT_ID
as repository secrets. See the GitHub Actions guide. Skipped when
that workflow file already exists.Monitoring mode track
1
Create monitoring pipeline
Pick an existing inference pipeline to receive your traces, or create a new
one (named
production by default).2
Write local credentials
Writes
.env.openlayer with your API key and inference pipeline id, and
adds it to your .gitignore.3
Instrument application
Adds Openlayer tracing to your application — with a detected coding agent,
with a prompt copied to your clipboard for your own agent, or manually by
following the instrumentation guide.
4
Verify traces
Asks you to run your application, then polls the pipeline until a new trace
actually arrives, so your setup is confirmed rather than assumed. It then
reminds you to add the API key to your production environment.
Project types
Wheninit creates a new project it asks what kind of AI task it is. The choice is recorded
as the project’s taskType and determines the shape of the scaffolded openlayer.json:
The prompt only appears when you create a new project. Linking to an existing project reuses
that project’s type.
Scaffolded configuration
If you choose the starter scaffold in the “Set up evaluations” step,init writes an
openlayer.json seeded for your project type plus a matching validation_dataset.csv:
validation_dataset.csv is a two-row placeholder using the same column
names — for example input,output for LLM projects and feature_1,feature_2,label,prediction
for tabular classification.
The scaffold deliberately leaves
"model": null, which is valid: it describes
a project that only uploads datasets. Replace the placeholder dataset with
your own, and add a model section if you want Openlayer to run your model
and generate outputs. See openlayer.json and
Configuring output generation.openlayer.json tailored to
your codebase rather than this placeholder.
Authentication
init handles sign-in itself — a separate openlayer login
is not required. It tries these in order:
OPENLAYER_API_KEYfrom your environment. If this variable is set, every API call uses it, overriding both saved profiles and browser sign-in.initverifies the key, tells you which account and workspace it belongs to, and asks whether to continue.- Credentials from a previous sign-in. If your CLI profile still works,
initshows the account and asks whether to keep using it. - A fresh sign-in.
initasks whether you are on Openlayer SaaS or a self-hosted / on-prem deployment — prompting for your server URL in the on-prem case — then offers browser sign-in (recommended) or pasting an API key. Browser sign-in shows a verification code and opens your browser, where you can also create a new Openlayer account. The resulting credentials are saved to your CLI profile.
OPENLAYER_API_KEY or already have a working profile, or init fails.
Files created
Re-running init
init is safe to re-run: each step checks whether it is already satisfied and skips itself,
reporting why. It will not create a duplicate project or overwrite an existing configuration.
- Already linked to a project → the “Link project” step is skipped.
openlayer.jsonalready exists → the “Set up evaluations” step is skipped, so your config is never clobbered..github/workflows/openlayer.ymlalready exists → the “Automate in CI” step is skipped.
init. There is no --force flag.
The monitoring track’s pipeline step is the one exception: interactive runs ask which pipeline
to use, but see the non-interactive caveat before re-running it in CI.
Flags
All flags exist to drive
init without prompts. In an interactive terminal you can ignore
them — init asks about each of these instead.
Global options such as --api-key, --profile-name and
--output-mode also apply.
Non-interactive use
init decides whether to prompt by looking at its environment rather than at a flag. It runs
interactively only when --output-mode is terminal (the default) and its standard output
is a terminal.
In non-interactive mode:
- Credentials are required up front. Set
OPENLAYER_API_KEY(or use--api-key), or have a profile from a previousopenlayer login. --project-idis required.initwill not create a project for you without prompts.--modedefaults tomonitoring. This is the biggest difference from an interactive run. If you want development-mode setup, pass--mode dev(or--mode both) explicitly — otherwise noopenlayer.jsonis written. See the--scaffoldcaveat if you are using that flag instead.- Everything that edits code or changes your account is opt-in. Instrumentation only runs
with
--agent, the first push only runs with--push, and the GitHub Action is only written with--github-action. - Monitoring runs are not fully idempotent. The pipeline step reuses an existing inference
pipeline only when the project has exactly one. With two or more and no prompt available, it
creates another pipeline named
productionon every run. Interactive runs always ask.
The monitoring track writes
.env.openlayer, containing your API key, into
the working directory. That means --mode monitoring, --mode both, a bare
--scaffold, and passing no track flag at all. In shared CI runners, prefer
--mode dev — or make sure the workspace is not archived as a build artifact.Example: bootstrapping development mode in CI
Exit codes
Quitting and failing share exit code
1, so scripts cannot distinguish them. The message on
standard output does: Init aborted. for a deliberate quit, Init failed: <reason> for an
error.
init vs link
Both commands connect a directory to an Openlayer project and both write.openlayer/config.json. The difference is the order of operations:
initasks for the project type, then writes anopenlayer.jsonto match. Use it when you have nothing set up yet.linkreads the task type from anopenlayer.jsonthat is already in the directory. Use it when your configuration exists and you only need the link.

