claude-ollama-live reference
Reference tables for claude-ollama-live environment variables, Claude Code CLI switches, oracle assertion fields, negative controls, and exit codes.
Environment variables
| Variable | Required value | Purpose |
|---|---|---|
| ANTHROPIC_BASE_URL | https://ollama.com (live) or http://127.0.0.1:PORT (mock) | Target origin for Anthropic Messages requests (/v1/messages). |
| ANTHROPIC_AUTH_TOKEN | OLLAMA_API_KEY secret (live) or dummy token (mock) | Bearer token sent to Ollama Cloud or loopback lmmock. |
| ANTHROPIC_API_KEY | "" (empty string) | Cleared so Claude Code uses ANTHROPIC_AUTH_TOKEN bearer routing without conflict. |
| ANTHROPIC_MODEL | glm-5.3-flash | Primary hosted Ollama Cloud model identifier. |
| ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL, ANTHROPIC_DEFAULT_HAIKU_MODEL, ANTHROPIC_DEFAULT_FABLE_MODEL | glm-5.3-flash | Pinned default model tier slots preventing incidental alias routing. |
| DISABLE_PROMPT_CACHING | 1 | Disable unsupported prompt-caching headers on Ollama Cloud. |
| HOME, CLAUDE_CONFIG_DIR | fresh temporary directories per invocation | Ensure zero inheritance from user ~/.claude settings and zero session persistence. |
Claude Code headless CLI switches
| Flag | Value | Purpose |
|---|---|---|
| --bare | flag | Run in minimal non-interactive bare mode. |
| -p | "Reply with exactly OLLAMA_CLAUDE_OK_107. Do not call any tools." | Execute the one-shot verification prompt with stdin closed. |
| --output-format | json | Emit structured final JSON envelope for oracle validation. |
| --tools | "" | Disable all built-in tools so no permission bypass flags are required. |
| --setting-sources | "" | Ignore user, project, and local settings files. |
| --no-session-persistence | flag | Do not write session state to disk. |
Oracle checks and negative controls
| Check | Expected client exit | Expected oracle verdict |
|---|---|---|
| Live positive (glm-5.3-flash) | 0 | PASS (type=result, subtype=success, is_error=false, result=="OLLAMA_CLAUDE_OK_107"). |
| Live invalid-bearer control | 1 | PASS (rejected by live server without using the real secret). |
| Mock positive (lmmock v0.1.94) | 0 | PASS (exact reply + verified POST /v1/messages HTTP 200 in lmmock audit). |
| Mock wrong-reply control | 0 | PASS (HTTP 200 and client exit 0, rejected semantically by exact-reply oracle). |
Exit codes
| Code | Meaning |
|---|---|
| 0 | All positive oracle assertions, request audits, and negative controls passed. |
| 1 | Client transport error, wrong reply text, missing HTTP 200 audit record, or failed negative control. |