One command to wire up your agent.
npx layerx1 writes the right config for your coding agent so it talks to the gateway. It deep-merges into your existing files, keeps timestamped backups, and is safe to re-run. Nothing to install — it runs from npm.
Quickstart
Run the interactive setup and answer a couple of prompts (key, tool, model):
npx layerx1Or do it in one non-interactive line — handy for scripts and dotfiles:
npx layerx1 setup \
--tool claude-code \
--key lx1_your_key \
--model lx1-gpt-oss-120bThe CLI is zero-dependency and never sends your key anywhere except into your own local config files. Point it at a self-hosted gateway with --url (default is the hosted gateway).
Commands
npx layerx1— interactive setup (alias forinit).npx layerx1 setup— non-interactive; takes--tool,--key,--model,--url.npx layerx1 status— show what is currently configured for each tool.npx layerx1 models— list the model catalog the gateway exposes.npx layerx1 test— send a real request through the gateway and print the reply.npx layerx1 unset— remove the Layer X1 config the CLI added (restores from backup).
Supported tools
--tool accepts: claude-code, codex, aider, continue, and cline. For the exact files each one writes (and how to do it by hand), see the per-tool guides: Claude Code, Codex CLI, and Other tools.
Cline is GUI-configured, so the CLI prints the values to paste rather than editing a file.
Safe by design
- Deep-merge— it merges into your existing config; it does not overwrite the whole file.
- Managed blocks— additions are fenced with
# >>> layerx1 >>>markers so they are easy to find and remove. - Backups— every change writes a timestamped
.layerx1.bak-*copy first. - Idempotent— re-running updates in place instead of duplicating, and it will not clobber a model key you already set (it prints the value instead).
Verify it worked
After setup, confirm the gateway is reachable:
npx layerx1 testA successful run prints a model reply served from https://api.layerx1.in. If it fails, check npx layerx1 status and your key.