SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
13 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
8.8 KB

# Grok Build (CLI / coding agent) and grok-build-0.1

Status: Grok Build product BETA (released 2026-05, docs.x.ai/build) · model grok-build-0.1 DOCUMENTED + LIVE_VERIFIED (chat completion 200; "early access" per release notes) · no public REST API for the CLI itself (local tool + ACP over stdio). Sources: Overview · CLI reference · Headless & scripting · Settings · Settings reference · MCP servers · Hooks · Skills, plugins & marketplaces · Subagents · Sandbox · Sessions · Modes & commands · Enterprise · ZDR video storage · Pricing · Release notes (May 2026 "Grok Build" + "Grok Build 0.1"). Last verified: 2026-09-18 (live: POST /v1/chat/completions model grok-build-0.1, raw tmp-live/xai-media/grok-build-chat.json). Machine-readable: model record in the models agent's generated/fragments/models/xai-models.json; this page documents the product surface.

# What is API-accessible

Surface Access Notes
grok-build-0.1 model POST /v1/chat/completions, /v1/responses (OpenAI-compatible) "xAI's coding model, trained specifically for agentic coding workflows. Currently in early access." Context 256k; aliases (live models list) grok-code-fast-1, grok-code-fast, grok-code-fast-1-0825 — i.e. the successor slug of Grok Code Fast 1. Text + image input, text output. Pricing $1.00 in / $0.20 cached / $2.00 out per 1M (< 200k prompt tokens), $2 / $0.40 / $4 above 200k. The docs overview says Grok Build "powers" and defaults to grok-build in config.toml, while the build overview markets grok-4.6 as "the same model that powers Grok Build" — both are selectable.
Grok Build CLI (grok) local binary (curl -fsSL https://x.ai/cli/install.sh | bash, irm https://x.ai/cli/install.ps1 | iex) TUI, headless (-p), ACP agent (grok agent stdio). Auth: browser login (OAuth / enterprise OIDC / device code grok login --device-auth) or XAI_API_KEY.
Media inside the CLI /imagine <prompt>, /imagine-video <prompt> Uses the Imagine APIs; under ZDR videos must go to your S3-compatible bucket via [tools.zdr_video_output_s3] (presigned output.upload_url passed to /v1/videos/generations).

# Live check — grok-build-0.1

{"model":"grok-build-0.1","messages":[{"role":"user","content":"Reply with OK."}],"max_tokens":8} → 200 in the standard chat-completion shape with reasoning_content ("The user said: "Reply with OK."\n"), usage: {prompt_tokens: 190, completion_tokens: 1, total_tokens: 423, prompt_tokens_details: {text_tokens: 190, audio_tokens: 0, image_tokens: 0, cached_tokens: 128}, completion_tokens_details: {reasoning_tokens: 232, …}, num_sources_used: 0, cost_in_usd_ticks: 5536000} ($0.00055), system_fingerprint fp_36bb860c5ab2a013, service_tier default. Note the 190 prompt tokens for a 4-word message (system scaffolding) and 232 reasoning tokens not counted in completion_tokens but billed.

# CLI at a glance

  • Subcommands: login, logout, inspect [--json] (rules, skills, plugins, hooks, MCP servers discovered), models, mcp list|add|remove|doctor, plugin …, plugin marketplace …, sessions list|search|delete, export, import (from Claude Code), memory clear, worktree …, dashboard, agent stdio (ACP), wrap, update, version, completions, setup (managed config).
  • Headless: grok -p "<prompt>" [-m model] [--output-format plain|json|streaming-json] [--always-approve] [--session-id|--resume|--continue] [--cwd] [--no-alt-screen] [--no-auto-update]. json → one object (with sessionId); streaming-json → NDJSON events. Sessions stored in ~/.grok/sessions.
  • ACP: grok agent stdio speaks JSON-RPC over stdin/stdout (initialize → session/new → session/prompt; text arrives as session/update agent_message_chunk); auth method id xai.api_key when XAI_API_KEY is set.
  • Flags: --model, --effort, --always-approve (--yolo), --allow/--deny <rule>, --sandbox <profile>, --rules, --system-prompt-override, --tools/--disallowed-tools, --max-turns, --no-plan/--no-subagents/--no-memory/--disable-web-search, --worktree, --fork-session. Claude Code flag aliases accepted (--allowedTools, --append-system-prompt, --dangerously-skip-permissions…).
  • Modes: Plan, Auto (classifier), Always-approve. ~50 slash commands (/model, /effort, /compact, /rewind, /fork, /loop, /deep-research, /workflow, /imagine, /imagine-video, /remember, /settings, /mcps, /hooks, /skills, /plugins …).

# Configuration

Scopes (merge order documented in Enterprise → Configuration): env GROK_* → user ~/.grok/config.toml ($GROK_HOME) → project .grok/config.toml (MCP, plugins, permission rules only) → managed ~/.grok/managed_config.toml, /etc/grok/managed_config.toml → requirements ~/.grok/requirements.toml, /etc/grok/requirements.toml (policy pins, highest priority; MDM).

toml
[models]
default = "grok-build"            # or "grok-4.6"
web_search = "grok-4.6"
[model."grok-4.6"]                # custom / BYOK models: OpenAI-compatible or Anthropic Messages
model = "grok-4.6"; base_url = "https://api.x.ai/v1"; env_key = "XAI_API_KEY"
api_backend = "responses"         # chat_completions | responses | messages
context_window = 500000; max_completion_tokens = 8192
[mcp_servers.linear]
url = "https://mcp.linear.app/mcp"; headers = { "Authorization" = "Bearer ${LINEAR_API_KEY}" }
[sandbox] profile = "workspace"   # off | workspace | devbox | read-only | strict | custom (sandbox.toml)

Credential resolution per model: model.api_key > model.env_key > active session token > XAI_API_KEY; enterprises can set disable_api_key_auth = true / force_login_team_uuid in requirements. Key env vars: XAI_API_KEY, GROK_DEFAULT_MODEL, GROK_MODELS_BASE_URL, GROK_SANDBOX, GROK_HOME, HTTPS_PROXY, GROK_POOL_IDLE_TIMEOUT_SECS (90 s), SSE idle timeout 600 s.

# Extensibility

Feature Where Notes
MCP servers grok mcp add <name> -- <cmd> (stdio) · grok mcp add --transport http <name> <url> [--header] · [mcp_servers.<name>] · also reads ~/.claude.json, .cursor/mcp.json, .mcp.json tools namespaced <server>__<tool>; OAuth handled; startup_timeout_sec 30, tool_timeout_sec 6000; grok mcp doctor
Hooks ~/.grok/hooks/*.json, .grok/hooks/*.json (needs /hooks-trust), Claude/Cursor hook files events SessionStart/End, UserPromptSubmit, PreToolUse (only blocking; exit 2 or {"decision":"deny"}), PostToolUse[Failure], PermissionDenied, Stop[Failure], Notification, SubagentStart/Stop, PreCompact/PostCompact; type: command | http; fail-open
Skills .grok/skills/, ~/.grok/skills/, plugin skills/, [skills] paths, ~/.agents/skills/ SKILL.md frontmatter (see docs/xai/skills-api.md); user-invocable skills become /<name>
Plugins / marketplaces .grok/plugins/, ~/.grok/plugins/, [[marketplace.sources]], --plugin-dir bundle skills, agents, hooks, MCP, LSP
Subagents general-purpose, explore, plan; custom under .grok/agents/; personas .grok/personas/*.toml [subagents.models] per-type routing
Sandbox Landlock (Linux) / Seatbelt (macOS) profiles child-network restriction Linux-only
Compatibility reads CLAUDE.md, .claude/rules/, AGENTS.md, Claude Code plugins/skills/hooks/MCP, Cursor MCP/hooks zero-config

# Enterprise

Network allow-list (api.x.ai only needed for API-key auth; otherwise an inference proxy), proxy support, OIDC SSO / external auth provider, device-code login, requirements.toml policy pins (sandbox, permissions, disable_api_key_auth, force_login_team_uuid), ZDR routing through a dedicated service identity, data-lifecycle description. Video generation under ZDR requires the S3 bucket config above.

# Not covered here

The grok-4.6 model card and the chat/responses parameters are the models/core agents' domain; docs/xai/skills-api.md covers the hosted Skills API; docs/xai/grok-apps-and-integrations.md covers Grok (grok.com/apps), Grok Bot and connectors.