npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@layer-ai/cli

v0.2.0

Published

Command-line interface for Layer AI - Manage gates, API keys, and configuration

Readme

@layer-ai/cli

Command-line interface for managing Layer AI gates, API keys, and configuration.

Installation

npm install -g @layer-ai/cli
# or use with npx
npx @layer-ai/cli

Quick Start

# Initialize a new config file
layer init

# Login to your Layer instance
layer login

# Create a gate interactively
layer gates create

# Sync your config file to remote
layer push

Authentication

Login

Authenticate with your Layer instance:

layer login

You'll be prompted for:

  • API URL (e.g., http://localhost:3001)
  • API Key

Credentials are stored locally in ~/.layer/credentials.json.

Commands

Initialization

layer init

Create a new layer.config.yaml file with example gates.

layer init
layer init --file custom-config.yaml

layer validate

Validate your config file without applying changes.

layer validate
layer validate --file custom-config.yaml

Gates

layer gates list

List all gates.

layer gates list

layer gates get <name>

Get details for a specific gate.

layer gates get my-gate

layer gates create

Create a new gate interactively.

layer gates create

You'll be prompted for:

  • Gate name
  • Model (gpt-4o, claude-sonnet-4, gemini-2.0-flash-exp, etc.)
  • Description
  • System prompt
  • Temperature (0-2)
  • Max tokens
  • Top P (0-1)
  • Allow overrides (yes/no)
  • Routing strategy (single, fallback, round-robin)
  • Fallback models (if applicable)
  • Tags

After creation, you can optionally pull the gate to your config file.

layer gates update <name>

Update an existing gate interactively.

layer gates update my-gate

After updating, you can optionally pull changes to your config file.

layer gates delete <name>

Delete a gate.

layer gates delete my-gate

layer gates suggestions <name>

Get AI-powered model recommendations for a gate (internal feature).

layer gates suggestions my-gate

API Keys

layer keys list

List all API keys.

layer keys list

layer keys create

Create a new API key.

layer keys create

You'll be prompted for a key name. The key will be displayed once - save it securely.

layer keys revoke <id>

Revoke an API key.

layer keys revoke key-abc123

Sync

layer pull

Pull gates from remote to your local config file.

layer pull
layer pull --file custom-config.yaml
layer pull --force  # Skip confirmation

This command:

  1. Fetches all gates from remote
  2. Compares with your local config
  3. Shows what will be added/updated/deleted
  4. Prompts for confirmation
  5. Updates your config file

layer push

Push gates from your local config file to remote.

layer push
layer push --file custom-config.yaml
layer push --force  # Skip confirmation

This command:

  1. Reads your local config file
  2. Compares with remote gates
  3. Shows what will be created/updated/deleted
  4. Prompts for confirmation
  5. Applies changes to remote

Configuration File

Layer uses a YAML configuration file (layer.config.yaml) to define gates.

For complete configuration documentation including field reference, routing strategies, best practices, and examples, see the Configuration Guide.

Workflow

Typical Development Workflow

# 1. Initialize a new project
layer init

# 2. Login to your Layer instance
layer login

# 3. Edit layer.config.yaml with your gates
vim layer.config.yaml

# 4. Push gates to remote
layer push

# 5. Make changes on remote (via dashboard or CLI)
layer gates update my-gate

# 6. Pull changes back to local
layer pull

CI/CD Integration

# In your deployment script
export LAYER_API_KEY=$PRODUCTION_API_KEY
layer push --file layer.config.yaml --force

Global Options

All commands support:

  • --help - Show help for the command
  • --version - Show CLI version

Examples

Create a production gate with fallback

layer gates create
# Name: production-gate
# Model: gpt-4o
# Routing strategy: fallback
# Fallback models: claude-sonnet-4, gemini-2.0-flash-exp

Sync config across environments

# Development
layer pull --file dev.layer.yaml

# Staging
layer pull --file staging.layer.yaml

# Production
layer pull --file production.layer.yaml

Manage API keys

# Create a key for your application
layer keys create
# Name: my-app-production
# [Save the generated key securely]

# List keys
layer keys list

# Revoke a compromised key
layer keys revoke key-abc123

Troubleshooting

Authentication Errors

If you get authentication errors, try logging in again:

layer login

Config File Errors

Validate your config file:

layer validate

Sync Conflicts

If you have conflicts between local and remote:

# Pull changes from remote (remote wins)
layer pull --force

# Push local changes to remote (local wins)
layer push --force

License

MIT