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

Providers

cmd supports multiple LLM providers through a unified interface.

Supported Providers

ProviderAPI FormatAuthLocal
AnthropicMessages APIAPI KeyNo
OpenAIChat CompletionsAPI KeyNo
OllamaOpenAI-compatibleNoneYes

Anthropic

Uses Claude models via the Messages API.

Endpoint: https://api.anthropic.com/v1/messages

Authentication: x-api-key header

Default model: claude-sonnet-4-6

Available models:

  • claude-sonnet-4-6 (default, balanced)
  • claude-opus-4-6 (most capable)
  • claude-haiku-4-5 (fast, cheap)

OpenAI

Uses GPT models via the Chat Completions API.

Endpoint: https://api.openai.com/v1/chat/completions

Authentication: Authorization: Bearer header

Default model: gpt-5.2

Available models:

  • gpt-5.2 (default, latest)
  • gpt-5.2-mini (fast, cheap)
  • gpt-5.1 (previous generation)

Ollama

Runs models locally using Ollama’s OpenAI-compatible API.

Endpoint: http://localhost:11434/v1/chat/completions

Authentication: None required

Default model: qwen2.5-coder

Setup:

# Install Ollama
brew install ollama

# Pull a coding model
ollama pull qwen2.5-coder
ollama pull codellama
ollama pull deepseek-coder

# Start server (if not running)
ollama serve

Azure OpenAI

Azure OpenAI uses the OpenAI-compatible format with a custom endpoint.

Endpoint format: https://<resource-name>.openai.azure.com/openai/deployments/<deployment-name>/chat/completions?api-version=<version>

# Set your Azure API key
export OPENAI_API_KEY=your-azure-api-key

# Use with custom endpoint
cmd -e "https://myresource.openai.azure.com/openai/deployments/gpt-5/chat/completions?api-version=2024-02-15-preview" \
    -m gpt-5.2 \
    "list files"

Custom Endpoints

Use the -e flag to specify a custom endpoint:

# Use a proxy
cmd -e https://my-anthropic-proxy.com/v1/messages "list files"

# Use a different Ollama host
cmd -e http://192.168.1.100:11434/v1/chat/completions "list files"

# Use a self-hosted vLLM server
cmd -e http://localhost:8000/v1/chat/completions -m my-model "list files"

# Use LM Studio
cmd -e http://localhost:1234/v1/chat/completions "list files"

Adding New Providers

Most providers are OpenAI-compatible. To use them:

  1. Set the appropriate API key (uses OPENAI_API_KEY)
  2. Use -e to specify their endpoint
  3. Use -m to specify the model name
# Groq (OpenAI-compatible, fast inference)
export OPENAI_API_KEY=gsk_...
cmd -e https://api.groq.com/openai/v1/chat/completions -m llama-3.3-70b-versatile "list files"

# Together AI
export OPENAI_API_KEY=...
cmd -e https://api.together.xyz/v1/chat/completions -m mistralai/Mixtral-8x7B-Instruct-v0.1 "list files"

# Fireworks AI
export OPENAI_API_KEY=...
cmd -e https://api.fireworks.ai/inference/v1/chat/completions -m accounts/fireworks/models/llama-v3-70b-instruct "list files"

# OpenRouter (access multiple providers)
export OPENAI_API_KEY=sk-or-...
cmd -e https://openrouter.ai/api/v1/chat/completions -m anthropic/claude-sonnet-4-6 "list files"

# Deepseek
export OPENAI_API_KEY=...
cmd -e https://api.deepseek.com/v1/chat/completions -m deepseek-coder "list files"

Provider Comparison

ProviderLatencyCostLocalBest For
AnthropicMedium$$NoAccuracy
OpenAIMedium$$NoGeneral use
Azure OpenAIMedium$$NoEnterprise
GroqFast$NoSpeed
OllamaVariesFreeYesPrivacy
TogetherFast$NoOpen models