claude-ollama-live guide
Overview
claude-ollama-live defines a deterministic CLI probe and a reusable GitHub Actions workflow that qualifies Claude Code (@anthropic-ai/claude-code@2.1.316) against Ollama Cloud's Anthropic-compatible Messages endpoint (https://ollama.com) alongside a loopback lmmock Anthropic handler.
Direct Ollama Cloud configuration and compatibility contract
Starting in Ollama 0.14.0, Ollama exposes an Anthropic-compatible /v1/messages endpoint. Rather than running a local Ollama proxy daemon in CI, claude-ollama-live connects Claude Code directly to https://ollama.com using bearer authentication:
- Base URL and bearer routing: set ANTHROPIC_BASE_URL=https://ollama.com (without a trailing /v1), ANTHROPIC_API_KEY="", and ANTHROPIC_AUTH_TOKEN from the OLLAMA_API_KEY secret.
- Model slot pinning: hosted model names (such as glm-5.3-flash) omit the :cloud suffix used by local signed-in proxies. Pin ANTHROPIC_MODEL and all four ANTHROPIC_DEFAULT_{OPUS,SONNET,HAIKU,FABLE}_MODEL environment variables to glm-5.3-flash so background helper calls cannot drift to another model alias.
- Prompt-cache and tool isolation: set DISABLE_PROMPT_CACHING=1 because Ollama's Anthropic compatibility layer does not support prompt-cache control blocks or count_tokens. The probe invokes claude with --bare -p --output-format json --tools "" --setting-sources "" --no-session-persistence and an explicit empty MCP configuration with stdin closed.
Organization-secret boundary and reusable workflow architecture
The live operator secret OLLAMA_API_KEY belongs to the private lmctlhq GitHub organization and is never copied into the public lmctl-ai organization:
- Public push workflow: runs the loopback lmmock job and visibly skips the live job. A skipped live job is never counted as live qualification.
- Private organization runner (lmctlhq/claude-ollama-live-runner): calls the public reusable workflow at an exact pinned commit SHA and passes secrets.OLLAMA_API_KEY by reference. Both live and mock jobs execute in full, emitting safe JSON summaries without uploading raw Claude logs, HOME directories, or session transcripts.
Loopback lmmock qualification and semantic negative controls
Every run proves both positive transport and negative failure detection:
- Live positive and negative control: the live job asserts exit 0, JSON type=result, subtype=success, is_error=false, and exact reply OLLAMA_CLAUDE_OK_107, then runs a synthetic invalid-key control that must fail with client exit 1.
- Mock positive and wrong-reply control: the mock job downloads and SHA-256-verifies lmmock (v0.1.94) with its shipped examples/llm-api.lms Anthropic Handler, confirms a real POST /v1/messages with HTTP 200 in the request audit, and runs a wrong-reply control that returns HTTP 200 and client exit 0 so the oracle's exact-text assertion proves it can fail semantically.