Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AI Provider Setup

OpenCrabs prend en charge 19 fournisseurs (18 intégrés + Custom compatible OpenAI). Configure-les via l’assistant d’onboarding ou à la main via config.toml et keys.toml dans ~/.opencrabs/.

Setup via Onboarding Wizard

The fastest way to configure a provider is the interactive wizard. Run /onboard:provider (or /onboard and navigate to step 3).

Keyboard Navigation

ToucheAction
↑ / ↓ or j / kMove between providers / models
Enter or TabAdvance to next field
BackTab or Shift+TabGo back to previous field
EscGo back to previous wizard step
Type any characterFilter model list (when on model picker)

For providers with a /v1/models API endpoint, the wizard fetches the model list live after you enter your API key.

Supported: Anthropic, OpenAI, OpenRouter, Gemini, MiniMax, Qwen (DashScope), Ollama, z.ai GLM

Flow:

  1. Use ↑/↓ to select your provider (e.g. OpenRouter)
  2. Press Enter: advances to the API key field
  3. Paste your API key (e.g. sk-or-...)
  4. Press Enter: triggers a live fetch from the provider’s /v1/models endpoint
  5. Use ↑/↓ to browse models, or type to filter (case-insensitive substring match)
  6. Press Enter on your chosen model: saves config and advances

Tip: If you’ve already configured a key, the wizard detects it (shown as ••••••••) and skips straight to the model picker. Press Enter to re-fetch models with the existing key.

OAuth Providers (GitHub Copilot, Codex)

No API key needed: authenticate through your browser.

Flow:

  1. Select GitHub Copilot or Codex
  2. Press Enter: starts the device-code PKCE flow
  3. A user code and URL appear (e.g. github.com/login/device)
  4. Open the URL in your browser, enter the code, and authorize
  5. Tokens are saved automatically to ~/.opencrabs/auth/
  6. Models are fetched live: pick one and press Enter

CLI Providers (Claude CLI, OpenCode CLI, Codex CLI)

Use your existing CLI subscription: no separate API key.

Flow:

  1. Select the CLI provider (e.g. Claude CLI)
  2. Press Enter: skips the API key field (none needed)
  3. Models are fetched from the local binary (claude models, opencode models, etc.)
  4. Pick a model and press Enter

Requirements: The CLI binary must be installed and authenticated in your PATH.

z.ai GLM (Zhipu AI)

z.ai has two endpoint types. The wizard asks which one before the API key.

Flow:

  1. Select z.ai GLM
  2. Press Enter: advances to Endpoint Type selector
  3. Use ↑/↓ to choose API (general) or Coding (CodeGeeX)
  4. Press Enter: advances to API key field
  5. Paste your key, press Enter, fetches models
  6. Pick a model and press Enter

Custom OpenAI-Compatible

For Ollama, LM Studio, LocalAI, Groq, NVIDIA, vLLM, or any OpenAI-compatible endpoint.

Flow:

  1. Select Custom OpenAI-Compatible (last in the list)
  2. Press Enter: advances to Name field
  3. Name: type a provider identifier (e.g. ollama, lm-studio, nvidia). Press Enter, normalized to a TOML-safe key
  4. Base URL: paste your endpoint (e.g. http://localhost:1234/v1). Press Enter
  5. API Key: paste if required, or leave empty for local endpoints. Press Enter
  6. Model: you have two options:
    • Type or paste a model name: use this for newly-launched models not yet available on the live API (e.g. qwen3.6-35b-a3b-gguf)
    • Press Enter on empty field: triggers a live fetch from {base_url}/models, then pick from the list
  7. Context Window: enter the token limit (e.g. 128000). Press Enter, saves and advances

Context Window Recommendation: Set to 200000 (200k tokens) for best results. OpenCrabs handles large contexts gracefully with smart auto-compaction that keeps you always up to date without manual intervention.

Local LLMs: No API key needed, just set base URL and model name. If the model is already running, paste the name directly. If you want to browse available models, leave the Model field empty and press Enter to fetch the list from your local server.

Re-running Provider Setup

CommandeWhat it does
/onboard:providerJump to provider setup, return to chat when done
/modelsSwitch provider/model for the current session
/onboardFull wizard (all steps)

Manual Configuration (advanced)

If you prefer editing files directly, configure providers in config.toml and keys.toml.


Key Handling (v0.3.81)

keys.toml no longer drops provider API keys at runtime (#1066): four providers could silently lose their keys during config reloads. The stored-key marker has one owner, and keys already poisoned by the old marker are self-healed on load. If a provider worked yesterday and 401s today, re-check keys.toml: the fix also repairs the file in place.

OpenCrabs (intégré)

C’est le fournisseur par défaut sur lequel arrive une installation neuve : sans compte, sans clé à coller, sans facturation. C’est le seul fournisseur à la fois gratuit et configuré d’usine.

Ce qu’il sert au jour 0

CapacitéModelNotes
Chatdeepseek-v4.1-flashFenêtre de contexte de 200k, fixe
Visiondeepseek-v4.1-flashvision_model pointe sur le même modèle, donc les images jointes marchent tout de suite
Génération d’imagesgemini-2.5-flash-imageImages uniquement : jamais proposé comme modèle de chat
Voix en entréeqwen3.8-omni-flashL’endpoint ne répond à aucune route /v1/audio/*, donc l’audio voyage comme partie input_audio dans la requête de chat
Voix en sortienon serviUne réponse parlée nécessite un autre moteur TTS (voir Voix)

La fenêtre de contexte est fixe à 200k. L’endpoint est gratuit et sert un seul modèle, donc context_window sur cette section est ignoré plutôt que borné.

Comment la clé fonctionne. Il n’y a aucune clé à trouver. Au premier usage, l’installation génère son propre ID et demande un token d’appelant à inference.opencrabs.com, qu’elle enregistre dans keys.toml sous [providers.opencrabs]. Une installation déjà enregistrée est réutilisée telle quelle, donc le deuxième lancement n’appelle jamais le proxy. Le binaire ne contient aucune clé partagée en amont, et le serveur ne garde qu’un hash de chaque token. Si tu perds keys.toml, l’installation redemande un token au lancement suivant.

Coût et limites. Gratuit, sans plafond d’usage pendant la phase expérimentale. Pour que ça reste ainsi, le proxy limite ou bloque les requêtes qui inondent le service ou qui créent des installations en masse. L’usage normal ne touche pas ces protections. Si les limites changent, le README le dit avant qu’elles s’appliquent.

Où vont tes données. Les requêtes de chat et d’image sont envoyées à inference.opencrabs.com, qui les transmet à l’hôte du modèle en amont. Si ce n’est pas acceptable pour une conversation, change de fournisseur.

Changer. Tape /models et choisis un autre fournisseur, ou lance /onboard et choisis Advanced. Les clés des autres fournisseurs restent intactes.

# config.toml
[providers.opencrabs]
enabled = false                              # onboarding turns this on; do not flip it by hand
default_model = "deepseek-v4.1-flash"
models = ["deepseek-v4.1-flash"]
vision_model = "deepseek-v4.1-flash"         # vision on day 0
generation_model = "gemini-2.5-flash-image"  # image generation on day 0, served only on the image route
stt_model = "qwen3.8-omni-flash"             # transcription on day 0

enabled = false est la valeur par défaut livrée, et cela veut dire “pas le défaut”, pas “mort” : les recherches par nom, /models, la chaîne de fallback et les substitutions image et vision atteignent toujours la section. Ce qu’elle ne peut pas faire, c’est fonctionner sans le token d’installation, donc l’activer à la main dans un home qui n’a jamais fait d’onboarding laisse un fournisseur sans identifiant. Choisis-la depuis l’onboarding.

gemini-2.5-flash-image est volontairement absent de models. Il n’est servi que sur /v1/images/generations, jamais comme modèle de chat, donc le lister là te valait une requête de chat en échec.

Anthropic Claude

Models: claude-opus-4-6, claude-sonnet-4-5, claude-haiku-4-5, and legacy models, fetched live from the API.

# keys.toml
[providers.anthropic]
api_key = "sk-ant-..."
# config.toml
[providers.anthropic]
enabled = true
default_model = "claude-sonnet-4-20250514"

Features: Streaming, tool use, extended thinking, vision, 200K context window.

OpenAI

Models: GPT-5 Turbo, GPT-5, and others, fetched live.

# keys.toml
[providers.openai]
api_key = "sk-YOUR_KEY"

OpenRouter: 400+ Models

Access 400+ models from every major provider through a single API key. Includes free models (DeepSeek-R1, Llama 3.3, Gemma 2, Mistral 7B).

# keys.toml
[providers.openrouter]
api_key = "sk-or-YOUR_KEY"

Get a key at openrouter.ai/keys. Model list is fetched live, no binary update needed when new models are added.

Google Gemini

Models: gemini-2.5-flash, gemini-2.0-flash, gemini-1.5-pro, fetched live.

# keys.toml
[providers.gemini]
api_key = "AIza..."
# config.toml
[providers.gemini]
enabled = true
default_model = "gemini-2.5-flash"

Features: Streaming, tool use, vision, 1M+ token context window.

Gemini also powers the separate image generation and vision tools. See Image Generation & Vision.

GitHub Copilot

Use your existing GitHub Copilot subscription: no separate API charges. Authenticates via OAuth device flow.

# config.toml
[providers.github_copilot]
enabled = true

Setup: Run /onboard:providers → select GitHub Copilot → follow the device code flow at github.com/login/device. Models are fetched live from the Copilot API.

Requirements: An active GitHub Copilot subscription (Individual, Business, or Enterprise).

z.ai (Zhipu AI)

Models: GLM-4-Plus, GLM-4-Flash, GLM-4-0520, CodeGeeX, fetched live. Two endpoint types: General API and Coding API.

# keys.toml
[providers.zai]
api_key = "your-api-key"
# config.toml
[providers.zai]
enabled = true
default_model = "glm-4-plus"

Get your API key at open.bigmodel.cn.

Qwen (DashScope)

Qwen models via DashScope. As of v0.3.81:

  • Reasoning carries across turns (#1033): preserve_thinking is sent so multi-turn conversations keep their reasoning context
  • Thinking knobs are family-gated (#1034): each model family gets only the knob it actually reads (enable_thinking, effort tiers), instead of a shared guess
  • Tiered families default to the recommended effort tier (#1034)
  • Hosted Qwen reachable everywhere (#1040): works outside Alibaba networks and with vendor-prefixed model ids

Claude CLI

Use your existing Claude Code subscription through the local claude binary, no separate API key needed. Supports streaming and extended thinking.

# config.toml
[providers.claude_cli]
enabled = true

Requirements: The claude CLI must be installed and authenticated. Models are detected automatically.

Ollama

Run any Ollama model natively: no custom provider setup needed. Supports both local (localhost:11434) and cloud (api.ollama.com) instances.

# config.toml
[providers.ollama]
enabled = true
default_model = "llama3"
# keys.toml (optional, only for cloud Ollama)
[providers.ollama]
api_key = "your-api-key"

Features: Streaming, tool use, local model tool-call extraction from text. Models are fetched live from the Ollama API.

Requirements: Ollama must be running locally (ollama serve) or you must have a cloud Ollama API key.

OpenCode CLI

Use the local opencode binary for free LLM completions, no API key or subscription needed. Supports NDJSON streaming and extended thinking.

# config.toml
[providers.opencode_cli]
enabled = true

Requirements: The opencode binary must be installed and available in your PATH. Models are fetched live via opencode models.

Codex CLI

Use OpenAI’s @openai/codex CLI as a native provider. User authenticates once via codex CLI; OpenCrabs piggybacks on cached credentials, zero API key handling. Non-interactive mode via codex exec --json with JSONL streaming.

# config.toml
[providers.codex_cli]
enabled = true

Models: GPT-5.5, GPT-5.4, GPT-5.3-Codex

Requirements: The codex CLI must be installed (npm install -g @openai/codex) and authenticated. Models are detected automatically.

Command Code CLI

Lance le CLI command-code (aussi installé comme cmd) en mode non interactif (command-code -p) et l’utilise comme backend du LLM, donc un compte Command Code existant marche sans clé API séparée. OpenCrabs garde les outils, la mémoire et le contexte en local.

# config.toml
[providers.command_code_cli]
enabled = true
default_model = "deepseek/deepseek-v4-flash"

L’authentification vient de ~/.commandcode/auth.json, écrit par le CLI lui-même. La liste de modèles reflète command-code --list-models, et le CLI valide le nom contre ce que ton compte atteint.

Contrairement aux CLI Claude et Codex, command-code -p répond en texte brut plutôt qu’en NDJSON, donc le fournisseur récupère stdout et le traduit en un seul message en stream. Cela veut dire pas de streaming token par token : la réponse arrive d’un bloc.

Fonctions : outils gérés en local, liste de modèles issue du CLI, aucune clé API à stocker

Codex OAuth

Native OpenAI Codex subscription auth via device-code PKCE flow. No CLI dependency, no API key. User authenticates through browser once; tokens stored in ~/.opencrabs/auth/codex.json with automatic refresh and background rotation.

# config.toml
[providers.codex]
enabled = true

Models: GPT-5.5, GPT-5.4, GPT-5.3-Codex (curated GPT-5 model list)

Setup: Run /onboard:provider → select Codex OAuth → follow the device code flow at auth.openai.com/codex/device. Two-step PKCE exchange: device auth poll → authorization code → token exchange.

Requirements: An active OpenAI Codex subscription. No CLI installation needed.

MiniMax

Models: MiniMax-M2.7, MiniMax-M2.5, MiniMax-M2.1, MiniMax-Text-01

# keys.toml
[providers.minimax]
api_key = "your-api-key"

Get your API key from platform.minimax.io. Model list comes from config.toml (no /models endpoint).

Moonshot Kimi

Modèles : k3, kimi-for-coding, kimi-for-coding-highspeed, récupérés en direct depuis l’API.

# keys.toml
[providers.moonshot]
api_key = "your-api-key"
# config.toml
[providers.moonshot]
enabled = true
default_model = "k3"
endpoint_type = "api"      # "api" (API plan) or "coding" (Coding plan)
reasoning_effort = "max"   # Sent only when the active model accepts it; a no-op otherwise

Deux types d’endpoint, choisis à l’onboarding ou avec /models :

  • Plan API (api) : paiement à l’usage sur api.moonshot.ai/v1, clé depuis platform.moonshot.ai
  • Plan Coding (coding) : abonnement à tokens Kimi sur api.kimi.com/coding/v1, clé depuis kimi.com

Un base_url que tu définis gagne toujours sur la valeur par défaut du plan. Le reasoning_content de Kimi marche sur les deux endpoints.

Fonctions : streaming, outils, API compatible [OI], liste de modèles en direct, contenu de raisonnement

Custom (OpenAI-Compatible)

Use for Ollama, LM Studio, LocalAI, Groq, or any OpenAI-compatible API.

# config.toml
[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"
models = ["qwen2.5-coder-7b-instruct", "llama-3-8B"]

Local LLMs: No API key needed, just set base_url and default_model.

Remote APIs (Groq, etc.): Add the key in keys.toml:

[providers.custom.groq]
api_key = "your-api-key"

Multiple Custom Providers

Define as many as you need with different names:

[providers.custom.lm_studio]
enabled = true
base_url = "http://localhost:1234/v1"
default_model = "qwen2.5-coder-7b-instruct"

[providers.custom.ollama]
enabled = false
base_url = "http://localhost:11434/v1"
default_model = "mistral"

Naming Custom Providers

The provider’s name is the last segment of its config section, nothing else.

[providers.custom.moonshotai]   # the name is "moonshotai"

When you reference the provider anywhere (self_improvement_provider, subagent_provider, plan_provider, execute_provider, or the /models command) use that bare name:

[agent]
self_improvement_provider = "moonshotai"        # ✅ bare section name
self_improvement_model = "kimi-k2.5"            # the model has its own key

Never carry the custom path into the reference, and never append the model:

self_improvement_provider = "custom:moonshotai"    # ❌ RSI silently never runs
self_improvement_provider = "custom.moonshotai"    # ❌ same
self_improvement_provider = "moonshotai/kimi-k2.5" # ❌ provider-only, model goes in self_improvement_model

Real case: a user with [providers.custom.glm-53-max] set self_improvement_provider = "custom:glm-53-max" and RSI silently never ran, Mission Control showed thousands of tool events recorded and unprocessed. Dropping the custom: prefix fixed it instantly (opencrabs#1314). Current main auto-corrects misspelled values with a warning; released versions fail silently, so spell it bare.

Free Prototyping with NVIDIA API

Kimi K2.5 is available for free on the NVIDIA API Catalog, no billing required.

# config.toml
[providers.custom.nvidia]
enabled = true
base_url = "https://integrate.api.nvidia.com/v1"
default_model = "moonshotai/kimi-k2.5"
# keys.toml
[providers.custom.nvidia]
api_key = "nvapi-..."

Fallback Provider Chain

Configure automatic failover when the primary provider fails (rate limits, outages, errors). Fallbacks are tried in order until one succeeds.

# config.toml
[providers.fallback]
enabled = true
providers = ["openrouter", "anthropic"]  # Tried in order on failure

Each fallback provider must have its API key configured in keys.toml. Both complete() and stream() calls are retried transparently, no changes needed downstream.

Single fallback shorthand:

[providers.fallback]
enabled = true
provider = "openrouter"

Or just ask your Crab: “Set up fallback providers using openrouter and anthropic”, it will configure config.toml for you at runtime.

Quota Circuit Breaker (v0.3.79)

Fallback chains now know the difference between a provider that is momentarily busy and one that is genuinely out of quota.

  • Hard quota exhaustion (your account has run out of credits/allowance for the period) trips a TTL circuit breaker on that provider. While the breaker is open the provider is skipped in fallback walks instead of being retried pointlessly, so failover lands on a provider that can actually serve the request.
  • Transient throttles (short rate limits, 429s that clear in seconds) are classified separately and retried as before, they never trip the breaker.
  • When every provider in the chain is exhausted, the failure is reported explicitly as chain exhaustion rather than surfacing as a confusing error from the last provider tried.
  • Retry notices now name the provider and model being retried, and state whether the cause was a quota exhaustion or a transient throttle.

No configuration needed: it is always on whenever a fallback chain is configured.

Fallback Improvements (v0.3.80)

  • Proactive setup suggestion (#1008): when no fallback chain is configured, OpenCrabs makes a one-shot suggestion to set one up, ask once, answered once, never nags again.
  • HTTP 400 failover guidance (#1006, #1007): a 400-series failure now carries guidance on what to check, and a chain-exhaustion ledger records why each provider in the chain was ruled out.
  • Fallback provenance in streaming logs (#969): each streamed call logs which provider actually served it, so retries and failovers are visible per call.
  • Codex CLI failures route into retry and fallback (#1004, #1005) instead of surfacing as terminal errors.

Provider Configuration Fields

Every provider section ([providers.<name>]) supports these fields:

FieldTypeDéfautDescription
enabledbooltrueEnable/disable the provider
api_keystringNoneAPI key (loaded from keys.toml or env)
base_urlstringNoneAPI base URL override (for custom/local providers)
default_modelstringNoneDefault model for this provider
modelsarray[]Available models (updated at runtime via /models)
force_defaultboolfalsePush this provider’s default pair to all sessions on reload (see Force Default Provider)
vision_modelstringNoneVision-capable model override (swaps in when images are present)
generation_modelstringNoneImage generation model override (wins over global image.generation.model)
context_windowu32NoneContext window size in tokens (for auto-compaction). Ignored on the built-in OpenCrabs provider, whose window is fixed at 200k
endpoint_typestringNoneEndpoint type for providers with multiple API modes (e.g. z.ai: "api" or "coding")
planstringNoneSubscription tier (Kimi Code: "moderato", "allegretto", "allegro", "vivace")
reasoning_effortstringNoneReasoning control (e.g. "max" for Kimi K3, "on"/"off" for K2.x)
voicestringNoneTTS voice name (e.g. "echo")
modelstringNoneTTS model override (e.g. "gpt-4o-mini-tts")
enable_thinkingboolNoneThinking mode for reasoning-capable models (Qwen, local providers)

Example: full provider config:

# config.toml
[providers.minimax]
enabled = true
default_model = "MiniMax-M2.7"
vision_model = "MiniMax-Text-01"
generation_model = "MiniMax-Image-01"
context_window = 200000
force_default = true

Force Default Provider

When you set force_default = true on a provider section, a config reload pushes that provider’s default pair (provider + model) to every non-archived session, overriding their stored pairs. This enforces your chosen default across all active sessions instead of just new ones.

# config.toml
[providers.minimax]
enabled = true
default_model = "MiniMax-M2.7"
force_default = true  # Pushes MiniMax M2.7 to all sessions on reload

How it works:

  • Only fires when the flagged section is the active default provider (set via /models or default_provider in [agent])
  • Archived sessions are never touched
  • Sessions already on the target pair are skipped
  • Without this flag: defaults apply to new sessions only, existing sessions keep their own provider/model

Use case: You want to roll out a new default model (e.g. MiniMax M2.7) across all active sessions immediately, not just new ones. Set force_default = true on the MiniMax section, reload config, and every session switches to M2.7.

Note: This only reinforces the default, it doesn’t override a different active provider. If a session is using Anthropic Claude and you set force_default = true on MiniMax, the Claude session stays on Claude (because MiniMax isn’t the active default).

Vision Model

When your default chat model doesn’t support vision, set vision_model to a vision-capable model on the same provider. This registers a vision tool that the agent can call, it sends the image to the vision model, gets a description back, and the chat model uses that context to reply.

# config.toml
[providers.minimax]
enabled = true
default_model = "MiniMax-M2.5"
vision_model = "MiniMax-Text-01"  # Agent calls vision tool → this model describes image → M2.5 replies
[providers.openai]
enabled = true
default_model = "gpt-5-nano"
vision_model = "gpt-5-nano"

MiniMax auto-configures vision_model = "MiniMax-Text-01" on first run. You can also ask your Crab to set it up: “Configure vision model for MiniMax”, it will update config.toml at runtime.

This is separate from the Gemini image tools which provide dedicated generate_image and analyze_image tools.

Per-Session Providers

Each session remembers its provider and model. Switch to Claude in one session, Gemini in another, switching sessions restores the provider automatically.

Model Picker (v0.3.75)

The /models picker got a real overhaul:

  • Opus 5 surfaced: Opus 5 now shows up via a third parallel list plus state discovery.
  • Newest-first ordering: models are ordered newest-first instead of by merge order.
  • claude-cli model discovery: the claude-cli model list is discovered live from the CLI instead of being hardcoded, with every claude-cli row formatted consistently.
  • Reconciled against live inventory: the picker reconciles against the live model inventory so it never offers a model that isn’t actually available.

Natural Model Naming (v0.3.76)

The /models command now accepts colloquial model names. Instead of typing the exact model ID, you can say it the way people talk:

/models opus        → claude-opus-4-8
/models sonnet      → claude-sonnet-4-20250514
/models gpt5        → gpt-5
/models qwen max    → qwen3.8-max-preview

The resolver normalizes spacing, case, and common abbreviations before matching against the provider’s model list. Exact matches still take priority.

Plan/Execute Provider Routing (v0.3.76)

The /plan and /execute commands can now route onto their own dedicated provider and model, separate from the main chat provider:

# config.toml
[agent]
plan_provider = "anthropic"
plan_model = "claude-opus-4-8"
execute_provider = "openrouter"
execute_model = "anthropic/claude-sonnet-4"

This lets you use a stronger model for planning (where reasoning quality matters most) and a faster/cheaper model for execution (where throughput matters). If unset, both fall back to the session’s active provider.