Introduction to ollacc
Relevant source files
The following files were used as context for generating this wiki page:
ollacc is a specialized wrapper and launcher designed to connect the Anthropic Claude Code CLI directly to the Ollama Cloud API. By bypassing the local Ollama server typically found at localhost:11434, ollacc reduces local resource overhead (CPU and RAM) and eliminates the need for a local Ollama installation when using cloud-hosted models. It primarily serves to manage authentication, model selection, and environment configuration required for the Anthropic SDK to communicate with OpenAI-compatible endpoints hosted by Ollama.
Sources: README.md:1-18, README.md:162-171
System Architecture and Execution Flow
The system operates as a shell-based utility that orchestrates the configuration of the Anthropic SDK. It manages a local configuration file, retrieves available cloud models via web scraping and API calls, and eventually executes the claude command with specific environment variables.
Logic Flow
The following diagram illustrates the lifecycle of an ollacc execution, from initial flag handling to the final execution of the Claude CLI.
Core Components
Authentication and Security
The authentication module ensures that the ANTHROPIC_AUTH_TOKEN is present and correctly formatted for the SDK. On the first run, it provides a splash screen directing users to generate a key at https://ollama.com/settings/keys.
- Key Storage: Stored in
~/.ollacc/configwithchmod 600permissions. - SDK Requirements: The launcher must export three specific variables. Notably,
ANTHROPIC_API_KEYmust be explicitly empty to prevent the SDK from ignoring theANTHROPIC_AUTH_TOKEN.
| Environment Variable | Value/Source | Purpose |
|---|---|---|
ANTHROPIC_BASE_URL | https://ollama.com | Redirects SDK to Ollama Cloud |
ANTHROPIC_AUTH_TOKEN | User API Key | Bearer token for authentication |
ANTHROPIC_API_KEY | "" (Empty) | Force SDK to use Auth Token |
Sources: lib/auth.sh:5-15, lib/auth.sh:61-65, README.md:139-152
Catalog Resolution
The system determines which models are available by intersecting two data sources:
- Popularity Scrape: Scrapes
https://ollama.com/search?c=cloudfor the top 10 popular models. - Auth'd Catalog: Queries
https://ollama.com/api/tagsusing the user's Bearer token to ensure the user has access to the models.
If both methods fail, the system falls back to a hardcoded list of known models: kimi-k2.7-code, minimax-m3, qwen3.5, glm-5.1, and minimax-m2.7.
Sources: lib/catalog.sh:28-73
Configuration Management
The lib/config.sh module provides helper functions for idempotent I/O operations on the configuration file. It includes a bash_escape function to ensure that special characters (e.g., $, `, *) do not break the shell script when the configuration is sourced.
Sources: lib/config.sh:11-35, lib/config.sh:41-65
Installation and Maintenance
The project includes robust scripts for setup and removal, ensuring the environment is correctly configured for different shells.
Installer Actions
The install.sh script performs the following tasks:
- Creates the
~/.ollaccdirectory structure. - Copies library files and the main launcher.
- Appends an alias to the user's shell profile (
.zshrc,.bashrc,.bash_profile, or.profile). - Sets up a default configuration file.
Sources: install.sh:31-77
Management Flags
Users can manage the internal state of ollacc using specific flags handled by lib/flags.sh.
| Flag | Action | Target Variable |
|---|---|---|
--model-clear | Removes the saved default model | OLLAMA_CLAUDE_DEFAULT_MODEL |
--key-clear | Removes the stored API key | ANTHROPIC_AUTH_TOKEN |
Sources: lib/flags.sh:13-33, README.md:111-118
Conclusion
ollacc serves as a bridge for developers wanting to utilize Ollama's cloud infrastructure with Anthropic's Claude Code tool. By automating environment variable management and providing a dynamic model selection menu based on live popularity rankings, it simplifies the workflow for high-concurrency "swarming" sessions that would otherwise be bottlenecked by local Ollama server proxies.
Sources: README.md:10-25, README.md:173-178