Last reviewed: 2025-02-21 Applies to: ax-cli/ax-grok v4.4.x
Note: The
ax-glmpackage has been deprecated. GLM/Z.AI users should use OpenCode - the official CLI from Z.AI.
ax-<provider> [message...] [options]
# providers: ax-grok, ax-cli (local/offline)
-p, --prompt <text>: headless, single prompt then exit.-d, --directory <dir>: working directory (default: current).-k, --api-key <key>: API key override (env vars preferred).-u, --base-url <url>: API endpoint override.-m, --model <name>: model override.--max-tool-rounds <n>: cap tool executions (default from settings).-c, --continue: resume the most recent conversation in the current directory.-v, --version: show version;-h, --help: show help.
--think: enable thinking/reasoning mode (Grok:reasoning_effortwhen supported).--no-think: disable thinking/reasoning.
--deterministic: setsdo_sample=false.--seed <number>: seed + deterministic.--top-p <number>: nucleus sampling (0–1). Use instead of or alongside temperature.
--file <path>: include file content.--selection <text>: include ad-hoc text.--line-range <start-end>: include a specific range (with--file).--git-diff: include current repo diff.
--json: JSON output (useful for editors/automation).--vscode: format output for VSCode integration.--no-agent: bypass agent-first mode.--agent <name>: force a specific AutomatosX agent (e.g.,backend,frontend,security).
- Grok (default base:
https://api.x.ai/v1):grok-4(default alias),grok-4.1,grok-4.1-fast-reasoning,grok-4.1-fast-non-reasoning,grok-4.1-mini,grok-4-0709,grok-3,grok-3-mini,grok-2-1212,grok-2-vision-1212,grok-2-image-1212. - Local/offline (default base:
http://localhost:11434/v1):qwen3:14b(default),qwen3:32b,qwen3:8b,qwen3:72b,qwen2.5-coder:32b,codegeex4.
- API keys:
XAI_API_KEY/GROK_API_KEY,AX_API_KEY(local). AI_MODEL: default model override.AI_BASE_URL: base URL override.
# Interactive (Grok)
ax-grok --think
# Headless (Grok) with reasoning and capped tool rounds
ax-grok -p "summarize tests" --think --max-tool-rounds 20
# Local edit via Ollama
ax-cli -p "rename foo to bar in src/index.ts" --model qwen3:14b --base-url http://localhost:11434/v1
# Continue previous conversation
ax-grok --continueGenerates AX.md at project root with AI-optimized context.
/init # Standard analysis (auto-refreshes if AX.md exists)
/init --depth=basic # Quick scan (name, language, stack)
/init --depth=standard # + Code stats, tests, docs
/init --depth=full # + Architecture, dependencies, hotspots
/init --depth=security # + Secret scanning, dangerous APIs
/init --force # Force complete regenerationDepth levels:
| Level | Includes |
|---|---|
basic |
Project name, language, tech stack, scripts |
standard |
+ Code statistics, test coverage, documentation analysis |
full |
+ Architecture mapping, dependency graph, hotspots, how-to guides |
security |
+ Secret detection, dangerous API usage, auth pattern analysis |
Adaptive output: Verbosity automatically adjusts based on project complexity (file count, LOC, dependencies).
Generated files:
AX.md- Primary context file (always).ax/analysis.json- Deep analysis data (full/security only)
Automatic context injection: When you start a conversation, AX CLI reads AX.md and injects its content into the AI's system prompt. The AI immediately understands your project's build commands, tech stack, and conventions.
Priority order: AX.md (primary) → ax.summary.json (legacy) → ax.index.json (legacy)
/help- Show all commands/model <name>- Switch AI model/lang <code>- Change language (en, zh-CN, zh-TW, ja, ko, de, es, pt, fr, vi, th)/doctor- Run diagnostics/mcp list- List MCP servers/mcp add <name> --template- Add MCP server from template/exit- Exit CLI
0success,1error or validation failure.
- Use CLI flags for one-offs; use project settings (
.ax-<provider>/settings.json) for repo defaults; use env vars for CI/secrets. - If a model does not support thinking,
--thinkis ignored. - Run
/initwhen starting a new project to generate context for better AI assistance.