Skip to main content

Usage

Start a local model, then launch an AI agent or program with environment variables automatically set to use the local model.

Arguments

string
Agent or program to run after the model is ready.Supported agents:
  • claude — Claude Code (Anthropic’s AI coding agent)
  • codex — Codex CLI (OpenAI’s coding agent)
  • openclaw — OpenClaw (open-source autonomous AI agent)
Omit to pick interactively from the list above.
array
Arguments forwarded to the program. Use -- to separate them from jan options.

Options

Model Selection

string
Model ID to load. Omit to pick interactively from installed models.
Can be:
  • A model ID from jan models list (e.g. qwen3.5-35b-a3b)
  • A HuggingFace repo ID (e.g. Qwen/Qwen2.5-35B-Instruct-GGUF) — will auto-download
string
Path to the inference binary. Auto-discovered from Jan data folder when omitted.

Server Configuration

number
default:"6767"
Port the model server listens on.
string
default:"jan"
API key for the model server. Exported as OPENAI_API_KEY and ANTHROPIC_AUTH_TOKEN.

Performance Configuration

number
default:"-1"
GPU layers to offload.
  • -1: All layers (full GPU acceleration)
  • 0: CPU only
  • > 0: Specific number of layers to offload
number
default:"4096"
Context window size in tokens.
Setting --ctx-size explicitly disables auto-fit. Omit this option when launching Claude to enable auto-fit by default.
boolean
Auto-fit context to available VRAM.
Default behavior:
  • When launching claude: --fit defaults to true (unless --ctx-size is set explicitly)
  • When launching other programs: --fit defaults to false

Output Control

boolean
default:"false"
Print full server logs (llama.cpp / mlx output) instead of the loading spinner.

Examples

Environment Variables

Depending on the launched agent, Jan sets different environment variables:

For Claude Code & Codex

For OpenClaw

Jan configures OpenClaw via ~/.openclaw/openclaw.json instead of environment variables:
Provider API keys are cleared to prevent overrides:
  • OPENAI_API_KEY, OPENAI_BASE_URL
  • ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_OAUTH_TOKEN
  • GEMINI_API_KEY, MISTRAL_API_KEY, GROQ_API_KEY
  • XAI_API_KEY, OPENROUTER_API_KEY

Output

Loading

Then Claude Code (or your chosen agent) starts with the local model pre-configured.

For OpenClaw

Workflow

When you run jan launch:
  1. Model Selection: Pick a model (interactively or via --model)
  2. Model Loading: Start the model server with optimized settings
  3. Environment Setup:
    • For Claude/Codex: Set environment variables
    • For OpenClaw: Write ~/.openclaw/openclaw.json
  4. Agent Launch: Execute the chosen program with the local model pre-wired
  5. Cleanup: When the agent exits, stop the model server

Supported Agents

Claude Code

Launches Anthropic’s Claude Code agent with:
  • ANTHROPIC_AUTH_TOKEN set to your API key (default: jan)
  • ANTHROPIC_BASE_URL pointing to local model
  • All Anthropic model defaults (OPUS, SONNET, HAIKU) set to your local model
  • Auto-fit enabled by default for maximum context window

Codex CLI

Launches OpenAI’s Codex CLI with:
  • OPENAI_API_KEY set to your API key (default: jan)
  • OPENAI_BASE_URL pointing to local model
  • OPENAI_MODEL set to your local model ID

OpenClaw

Launches the open-source OpenClaw agent with:
  • ~/.openclaw/openclaw.json configured with Jan provider
  • Default model set to jan/<model_id>
  • OpenClaw’s TUI automatically started (unless you pass custom args)

Performance Tips

Maximize Context for Claude Code

Auto-fit is enabled by default when launching Claude, maximizing the context window based on available VRAM.

Custom Context Size

Setting --ctx-size explicitly disables auto-fit and uses your specified size.

CPU-Only Mode

HuggingFace Auto-Download

Download and launch with a HuggingFace model:
Jan will:
  1. Fetch available GGUF files
  2. Let you pick a quantization
  3. Download the model
  4. Start the model server
  5. Launch Claude Code
For private/gated models:

Troubleshooting

Agent Not Found

Solution: Ensure the agent is installed and available in your PATH.

Model Not Found

Solution: Download the model using the Jan desktop app, or use a HuggingFace repo ID to auto-download.

Binary Not Found

Solution: Install a backend from Jan’s settings, or specify the binary path with --bin.

OpenClaw Config Override

If OpenClaw still uses a cloud provider instead of Jan: Solution: Check for environment variables that override the config:
Jan clears these automatically, but they may be set in your shell config (.bashrc, .zshrc, etc.).

See Also

Serve Command

Run models without launching an agent

Commands Reference

Complete reference for all CLI commands