Docs Install CLI

Install CLI

Install the contento CLI and configure your AI provider in under a minute.

Prerequisites

DependencyVersionNotes
Node.js18+LTS recommended
npm9+Included with Node.js

Install

# Install globally via npm
npm install -g contento-cli

# Verify installation
contento --version
contento v0.1.0

# Or run without installing (one-shot)
npx contento-cli --version

Configure Your AI Provider (BYOK)

Contento has no login or central account. The only thing the CLI needs to generate pages is an AI provider key. Run the interactive setup once:

contento config set

  ? AI Provider: OpenAI
  ? Model: gpt-4o-mini (default)
  ? API Key: ************************************
  ✓ AI configuration saved to ~/.contento/config.json

Or pass it non-interactively (recommended for CI and agents):

contento config set \
    --provider openai \
    --model "gpt-4o-mini" \
    --api-key "sk-proj-..."

You can also drop the provider key into an environment variable and skip config set entirely:

export OPENAI_API_KEY=sk-proj-...
# or ANTHROPIC_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY
Tip: Mix providers across projects by overriding with --provider on individual collections generate runs. Local models work too — point at any OpenAI-compatible endpoint via --base-url.

Configuration Files

Contento stores everything locally in ~/.contento/:

{
  "provider": "openai",
  "model": "gpt-4o-mini",
  "apiKey": "sk-proj-...",
  "workers": 5
}

Environment Variables

VariableDescription
OPENAI_API_KEYOpenAI key (used when provider is openai)
ANTHROPIC_API_KEYAnthropic key
GROQ_API_KEYGroq key
OPENROUTER_API_KEYOpenRouter key
CONTENTO_PROVIDEROverride the configured provider
CONTENTO_MODELOverride the configured model identifier
NO_COLORDisable colored output

Global Flags

FlagDescription
--jsonOutput machine-readable JSON instead of formatted tables
--no-colorDisable colored output
-v, --verboseEnable verbose logging
-V, --versionShow CLI version
-h, --helpShow help for any command

Verify Everything Works

# Confirm your AI configuration
contento config show

# Browse the bundled niches
contento niches list --category "Software / SaaS"

# List available schemas
contento schemas list

Recommended: Set Up an Astro Site

Contento works with any static site or framework, but Astro is the cleanest fit and what we recommend for new projects. Astro produces static HTML, ships zero JavaScript by default, and treats Contento's output directory as just another set of files to serve. If you don't already have a host site, start here:

# Scaffold a new Astro site (in a sibling directory)
npm create astro@latest my-site

# Move into it and install
cd my-site && npm install

# Initialize a Contento project that outputs into Astro's public/articles/
contento init \
    --name "My Articles" \
    --domain example.com \
    --output ./public/articles

# Point chrome at Astro's compiled layout (after one astro build)
npm run build
contento projects chrome \
    --header ./dist/_chrome/header.html \
    --footer ./dist/_chrome/footer.html \
    --css ./public/styles.css

Why Astro is the recommended host:

  • Static HTML output — Astro's npm run build produces exactly the kind of files Contento expects to live alongside
  • Zero-config drop-in — anything in public/ is served as-is on the same domain at on-domain paths
  • Layouts as chrome — an Astro layout component compiles to a header/footer pair you can hand to contento projects chrome
  • Same deploy targets — Netlify, Vercel, Cloudflare Pages, S3, GitHub Pages all work for both Astro's site and Contento's pages without any extra config
Already have a site? Skip this section. Contento works equally well with Next.js, Eleventy, Hugo, plain HTML, or any other static output. The Astro recommendation is for greenfield projects where you haven't picked a framework yet.

Next Steps