Model Switching

Copair supports multiple AI providers and models. You can switch between them at any time during a session — no need to restart.

Supported Providers

ProviderModelsAPI Key Required
AnthropicClaude Opus 4.8, Sonnet 4.6, Haiku 4.5Yes
OpenAIGPT-5, GPT-5 Mini, GPT-4o, o3, o4-miniYes
GoogleGemini 3 Pro, Gemini 3 Flash, Gemini 2.5 ProYes
MoonshotKimi K2 (via OpenAI-compatible endpoint)Yes
OllamaLlama 4, Qwen 2.5, Mistral, DeepSeek V3, etc.No
Amazon BedrockAny Bedrock model via an OpenAI-compatible gatewayYes
Any OpenAI-compatiblevLLM, LM Studio, llama.cppVaries

Switching Models Mid-Session

Use the /model command to switch models without losing your conversation context:

> /model

Copair will display a list of configured providers and models. Select one to switch immediately.

Quick Switch

You can also specify the model directly:

> /model anthropic:claude-sonnet-4.6
> /model openai:gpt-5
> /model ollama:llama4

Configuring Providers

Add providers by editing ~/.copair/config.yaml (global) or .copair/config.yaml (project-level).

Single provider

# ~/.copair/config.yaml
version: 1
default_model: claude-sonnet

providers:
  anthropic:
    api_key: ${ANTHROPIC_API_KEY}
    models:
      claude-sonnet:
        id: claude-sonnet-4-6

Multiple providers

You can configure multiple providers simultaneously — all appear in the /model menu:

version: 1
default_model: claude-sonnet

providers:
  anthropic:
    api_key: ${ANTHROPIC_API_KEY}
    models:
      claude-sonnet:
        id: claude-sonnet-4-6

  openai:
    api_key: ${OPENAI_API_KEY}
    models:
      gpt-5:
        id: gpt-5

  google:
    api_key: ${GOOGLE_API_KEY}
    models:
      gemini-flash:
        id: gemini-3-flash

OpenAI-Compatible Endpoints

For self-hosted or alternative providers that use the OpenAI API format, set type: openai-compatible:

providers:
  ollama:
    type: openai-compatible
    base_url: http://localhost:11434/v1
    models:
      llama4:
        id: llama4
        supports_tool_calling: false

This works with Ollama, vLLM, LM Studio, llama.cpp, and any OpenAI-compatible server.

How Copair Classifies Models

Whichever model you switch to, copair classifies it to decide how to drive it — chiefly its tier: small (engage the small-model harness) or large (run without it). The tier is derived from the model's family, and it determines tool-call format, context defaults, and whether guardrails like the loop guard and format-error repair kick in. Run copair --explain-model <id> to see exactly what copair decided and why.

Unknown models are strict

If you switch to a model copair doesn't recognize, it won't guess — it stops with a clear error rather than silently assuming defaults:

Unknown model "my-finetune-7b". Add it to model_overrides in your config
with at least `tier: small | large`.

This is deliberate. A wrong guess (treating a small open-weight model as large, or vice-versa) engages the wrong behavior and wastes tokens. The fix is one line in ~/.copair/config.yaml:

model_overrides:
  my-finetune-7b:
    tier: small   # or large

See Custom & Local Models for the full walkthrough and ready-to-paste Ollama / vLLM / LM Studio / llama.cpp configs.

The tier boundary: ≤22B is "small"

Copair treats models ≤22B parameters as small — the point below which the harness reliably helps. Models right at the boundary are classified small: Mistral-Small 3 (22B), DeepSeek-R1 distill 14B, Phi-4 14B. Larger models run without the harness. If a model sits near the line and you disagree with copair's call, override tier explicitly.

When to Switch Models

  • Complex reasoning — Use Claude Opus 4.8 or GPT-5 for architecture decisions and multi-step refactoring
  • Quick edits — Use a faster model like Gemini 3 Flash or Claude Haiku 4.5 for small changes
  • Local/offline — Switch to Ollama with Llama 4 or Qwen 2.5 when you don't have internet access
  • Cost optimization — Use local models for exploration, cloud models for final implementation

Last updated July 1, 2026