Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLIProxyAPI + Claude Code setup for macOS

One-command, API-key-only setup for using Claude Code with six models from three provider keys:

  • Anthropic: claude-sonnet-5, claude-opus-4-8
  • OpenAI: gpt-5.6-sol, gpt-5.6-terra through the Responses API
  • Ollama Cloud: deepseek-v4-flash, glm-5.2

One more model is supported by the launcher but requires a manual config addition (see Adding Grok):

  • xAI: grok-4.5

No provider OAuth login is used.

Requirements

  • macOS 13 or newer
  • Homebrew
  • API keys for Anthropic, OpenAI, and Ollama Cloud
  • An xAI API key, only if you want grok-4.5 (see Adding Grok)

The installer adds CLIProxyAPI, Claude Code (when missing), jq, and ripgrep.

Install

git clone <REPOSITORY_URL>
cd cliproxyapi-claude-code-macos
./install.sh

The three API-key prompts are hidden. Real keys are written only to ~/.cli-proxy-api/config.yaml, which is created with mode 600. They are not written into this repository or shell history.

For non-interactive provisioning, the installer also accepts ANTHROPIC_API_KEY, OPENAI_API_KEY, and OLLAMA_API_KEY from the environment. Interactive prompts are safer for ordinary use because exported secrets can be inherited by child processes.

To configure without making six live test calls:

./install.sh --skip-doctor

Use

Open a new terminal and run:

cc

This opens an interactive picker. Direct aliases are also available:

cc sonnet
cc opus xhigh
cc gpt high
cc deepseek high
cc glm high
cc terra high
cc grok high

See the complete cc usage guide for model aliases, effort controls, diagnostics, configuration, logs, troubleshooting, and forwarded Claude Code arguments.

Inside Claude Code, /model retains the model selected by cc. Use /effort to adjust reasoning during a session.

Verify

cc doctor
cc status

cc doctor sends one small live request to each model and requires it to return an Anthropic-compatible tool call. It verifies routing, reasoning settings, request/response translation, and function tools.

Included dummy configuration

Do not copy a working ~/.cli-proxy-api/config.yaml into Git: it contains real provider keys. The repository ignores a root config.yaml as an extra guard.

Why GPT uses codex-api-key

CLIProxyAPI's generic OpenAI-compatible executor uses Chat Completions. GPT-5.6 Sol requires the Responses API to combine reasoning effort with function tools, so this setup uses CLIProxyAPI's API-key codex-api-key provider pointed at https://api.openai.com/v1. This is still standard OpenAI API-key authentication, not OAuth.

Adding Terra

gpt-5.6-terra reuses the same OpenAI key as gpt-5.6-sol — it's already provisioned by install.sh, no extra key needed. It's a second model entry under the same codex-api-key provider in config/cliproxyapi.example.yaml.

Adding Grok (manual)

grok-4.5 is not yet wired into install.sh's key prompts, so it needs one manual step after install. Add an xAI API key (from console.x.ai) as a new openai-compatibility provider in ~/.cli-proxy-api/config.yaml:

openai-compatibility:
  # ...existing providers...
  - name: "xai"
    base-url: "https://api.x.ai/v1"
    api-key-entries:
      - api-key: "xai-YOUR-KEY-HERE"
    models:
      - name: "grok-4.5"
        alias: "grok-4.5"
        display-name: "Grok 4.5"
        thinking:
          levels: ["low", "medium", "high"]

Then:

chmod 600 ~/.cli-proxy-api/config.yaml
brew services restart cliproxyapi
cc doctor grok

Grok 4.5 only supports low/medium/high effort (no none or xhigh).

Files installed

Path Purpose
~/.local/bin/cc Claude Code model picker and diagnostics
~/.cli-proxy-api/config.yaml Private provider configuration and keys
~/.cli-proxy-api/client-token Random localhost proxy token
$(brew --prefix)/etc/cliproxyapi.conf Symlink to the private config

Existing CLIProxyAPI and Claude settings are timestamp-backed up before they are changed. If Claude Code has apiKeyHelper, the installer removes only that field because it conflicts with the launcher's ANTHROPIC_AUTH_TOKEN; the full settings file is backed up first.

Uninstall

Preserve private configuration:

./uninstall.sh

Also remove ~/.cli-proxy-api:

./uninstall.sh --purge

Development test

The smoke test uses an isolated temporary home, fake Homebrew/Claude binaries, dummy keys, and a local mock API. It does not alter the real user setup:

./tests/smoke.sh

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages