Providers

Clew supports 27 AI providers with a unified adapter layer. Set your API keys as environment variables and switch between providers at runtime with /model.

Provider configuration is declared in src/services/ai/providers.json. The ProviderManager resolves API keys, selects models, and manages provider config. Non-Anthropic providers are normalized via the AnthropicAdapter or GoogleAdapter.

All Providers

ProviderEnv KeyDefault ModelNotes
AnthropicANTHROPIC_API_KEYclaude-sonnet-4-7Native Claude support with full tool calling and reasoning. Context: 1M tokens.
OpenAIOPENAI_API_KEYgpt-5.5GPT-5.5, GPT-5.5 Pro, GPT-5.4 Mini. Context: 1M+ tokens.
GoogleGOOGLE_API_KEYgemini-3.1-flashGemini 3.1 Flash, Pro. Context: up to 2M tokens. Uses GoogleAdapter.
GitHub CopilotCOPILOT_GITHUB_TOKENgpt-5.5Access via GitHub token. Includes Claude and GPT models. Context: 1M tokens.
OpenRouterOPENROUTER_API_KEY100+ models via routed API. OpenAI-compatible.
DeepSeekDEEPSEEK_API_KEYdeepseek-v4-proDeepSeek V4 Pro, V4 Flash. Context: 1M tokens. MoE architecture.
OpenCodeOPENCODE_API_KEYclaude-opus-4-7OpenCode AI gateway. OpenAI-compatible. Includes Claude, GPT, Gemini, Kimi, GLM, MiniMax.
OpenCode GoOPENCODE_GO_API_KEYminimax-m2.7Low cost subscription tier for open coding models.
Cline APICLINE_API_KEYanthropic/claude-opus-4-7OpenAI-compatible. Model IDs format: provider/model-name.
GroqGROQ_API_KEYLlama 4 70B, 8B. Fast inference. Context: 128K tokens.
xAIXAI_API_KEYgrok-4-20Grok 4.20, Grok 4. Context: 128K tokens. Vision and tool calling.
MistralMISTRAL_API_KEYmistral-small-latestMistral Large 4, Small 4, Ministral 3 14B. Tool calling and vision support.
KiloCodeKILOCODE_API_KEYkilo-auto/freeGateway with 500+ models. Includes free tier.
Ollama (Local)OLLAMA_API_KEYllama3.3Local models via Ollama server at http://localhost:11434/v1. Offline-capable.
Together AITOGETHER_API_KEYLlama 4 models. OpenAI-compatible.
Fireworks AIFIREWORKS_API_KEYLlama 4 70B. Fast inference.
NVIDIA NIMNVIDIA_API_KEYNVIDIA AI Foundation Models. DeepSeek, Llama 3.1, Nemotron.
CohereCOHERE_API_KEYcommand-r-plusCommand R+ model. 128K context. No vision.
Deep InfraDEEPINFRA_API_KEYOpenAI-compatible gateway. Llama 4 Scout with 327K context.
PerplexityPERPLEXITY_API_KEYSonar Huge Online. No tool calling support.
CerebrasCEREBRAS_API_KEYWafer-Scale Engine. Extremely fast inference. Qwen 3 235B.
SiliconFlowSILICONFLOW_API_KEYChina-based AI platform. DeepSeek V4 Pro and Flash.
Moonshot AI (Kimi)MOONSHOT_API_KEYkimi-latestKimi models. 128K context. Vision and tool calling.
Zhipu AI (GLM)ZHIPU_API_KEYglm-4GLM-4 model. 128K context.
Hugging FaceHUGGINGFACE_API_KEYInference API. Llama 3.1 70B. No tool calling.
PoePOE_API_KEYOpenAI-compatible gateway. Claude 3.7 Sonnet available.
DigitalOceanDIGITALOCEAN_API_KEYServerless Inference. Llama 3.1 70B.

Provider Selection

ProviderManager resolves the active provider by:

  1. Scanning environment variables for configured API keys
  2. Loading provider metadata from providers.json
  3. Resolving model names to provider-specific identifiers
  4. Applying the adapter layer for non-Anthropic providers
  5. Handling config migration and backward compatibility

Adapter Layer

Non-Anthropic providers pass through adapters that normalize:

  • Content blocks — text, tool_use, tool_result, thinking block conversion (contentBlockUtils.ts)
  • Tool calls — parsing across provider formats (toolCallParser.ts)
  • Streaming chunks — per-chunk normalization for real-time display
  • Errors — normalization with retry/rate-limit handling (errorNormalizer.ts)
  • Usage — token counting and cost estimation (usageNormalizer.ts)

Runtime Switching

/model                          # Interactive model picker
/model list                     # List all available models across providers
/model claude-sonnet-4-7        # Switch to a specific model
/provider-select                 # Show or change active provider

Provider Capabilities

Each provider declares capabilities in providers.json:

  • chat — Chat completion endpoint
  • streaming — full, partial, or none
  • toolCalling — native, adapted, or none
  • vision — Image input support
  • jsonSchema — Structured output via JSON schema
  • reasoningEffort — Configurable reasoning depth
  • contextLength — Maximum context window size

Local / Offline Development

# Ollama — fully offline
export OLLAMA_API_KEY=ollama  # (any non-empty value)
export OLLAMA_HOST=http://localhost:11434
clew
> /model ollama/llama4:70b

# Debug specific provider
DEBUG=provider:anthropic clew