npm package: @jayjiang/open-cc
Description: Open CC — AI coding assistant CLI in the terminal
Author: JayJiangCT
Latest version: 0.4.0

# Open CC

An AI coding assistant CLI tool for the terminal, with multi-provider LLM support (50+ providers including Anthropic, OpenAI, GitHub Copilot, Google Vertex AI, DeepSeek, and more).

## Install

```bash
npm install -g @jayjiang/open-cc
```

Or with Bun:

```bash
bun install -g @jayjiang/open-cc
```

## Setup

### Option 1: Interactive `/connect` (Recommended)

Launch Open CC and use the `/connect` command to pick a provider and authenticate:

```bash
opencc
# Then type: /connect
```

Supports 50+ providers dynamically loaded from [models.dev](https://models.dev), including:

**Popular**: Anthropic, GitHub Copilot, OpenAI, Google, OpenRouter, Kimi, Zhipu AI, MiniMax

**International**: Mistral, Groq, xAI, Cohere, Perplexity, Together AI, Fireworks, DeepInfra, Cerebras

**China**: DeepSeek, Qwen, Moonshot, Doubao, Baichuan, Hunyuan, ERNIE, SenseTime, and more

### Google Vertex AI

Vertex AI uses Google Cloud Application Default Credentials (ADC). The `/connect` flow guides you through:

1. Checks that `gcloud` CLI is installed
2. Prompts for GCP project ID and region
3. Verifies ADC credentials (runs `gcloud auth application-default login` if needed)
4. Available models: Gemini 3.1 Pro, 3.1 Flash Lite, 3 Flash, 2.5 Flash, 2.5 Pro

```bash
# Pre-requisite: install gcloud CLI and authenticate
gcloud auth application-default login

# Then in Open CC:
/connect  # Select "Google Vertex AI"
```

### Option 2: Environment Variable

Set your API key for any provider:

```bash
# Anthropic (default)
export ANTHROPIC_API_KEY="sk-ant-..."

# OpenAI
export OPENAI_API_KEY="sk-..."

# DeepSeek
export DEEPSEEK_API_KEY="sk-..."

# GitHub Copilot (use gh CLI token)
# Authenticate via /connect in the app

# See presets.ts for all supported env var names
```

### Option 3: Settings File

Edit `~/.open-cc/settings.json`:

```json
{
  "connectedProvider": "openai",
  "model": "gpt-4o",
  "providers": {
    "openai": {
      "auth": { "type": "api-key", "key": "sk-..." }
    }
  }
}
```

## Usage

```bash
# Interactive REPL
opencc

# Pipe mode (non-interactive)
echo "explain this error" | opencc -p

# Resume last session
opencc --resume
```

### Provider Commands

```bash
# Inside the REPL:
/connect          # Switch provider (search, Popular/Other groups)
/model            # Switch model for current provider
```

## Features

- Interactive REPL terminal UI (React + Ink)
- **50+ LLM providers** via OpenAI-compatible adapter + models.dev catalog
- `/connect` command with search, Popular/Other grouping, OAuth support
- GitHub Copilot OAuth device code flow
- Google Vertex AI with Application Default Credentials (ADC)
- Streaming conversations with tool calls
- File read, write, edit, and search tools
- Shell command execution with sandbox support
- Sub-agent dispatching
- MCP Server integration
- Session resume and compaction
- Permission management system
- Hook system for automation
- Skills / slash commands

## Configuration

Global config lives at `~/.open-cc/`:

| Path | Purpose |
|------|---------|
| `settings.json` | Global settings (provider, model, auth, etc.) |
| `sessions/` | Session history |
| `memory/` | Persistent memory files |
| `cache/models.json` | Cached models.dev provider catalog |

Project-level config: place a `CLAUDE.md` in your project root.

## Development

### Prerequisites

- [Bun](https://bun.sh/) >= 1.2.0

### Commands

```bash
bun install            # Install dependencies
bun run dev            # Dev mode (direct execution)
bun run build          # Build to dist/
bun run lint           # Lint (Biome)
bun run lint:fix       # Auto-fix lint issues
bun run format         # Format source
bun test               # Run tests
bun run health         # Health check (lint + tests + build)
```

### Adding a New Provider

See the integration guides for pitfalls and checklists:
- [Multi-Provider Integration Guide](./docs/multi-provider/integration-guide.md) (GitHub Copilot)
- [Vertex AI Integration Guide](./docs/multi-provider/vertex-ai-integration.md) (Google Cloud ADC)

## Tech Stack

- **Runtime**: Bun
- **UI**: React + Ink (terminal rendering)
- **CLI**: Commander.js
- **API**: Multi-provider (Anthropic SDK + OpenAI-compatible adapter)
- **Provider Catalog**: [models.dev](https://models.dev) (50+ providers, auto-refreshed)
- **Build**: Bun.build() with code splitting

## License

Proprietary - See [LICENSE](./LICENSE)