Skip to content

Commit 98da583

Browse files
committed
docs: readme.md
1 parent fab64e7 commit 98da583

File tree

1 file changed

+81
-25
lines changed

1 file changed

+81
-25
lines changed

README.md

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,70 @@ This project is inspired by [Clude Code Router](https://github.com/musistudio/cl
2424

2525
## Quick Start
2626

27+
> **Note**: When installed with `go install`, the binary is named `claude-code-open`. Throughout this documentation, you can substitute `cco` with `claude-code-open` or create an alias as shown in the installation section.
28+
2729
### Installation
2830

31+
#### Option 1: Install with Go (Recommended)
32+
33+
The easiest way to install is using Go's built-in installer:
34+
35+
```bash
36+
# Install directly from GitHub
37+
go install github.com/Davincible/claude-code-open@latest
38+
39+
# The binary will be installed as 'claude-code-open' in $(go env GOBIN) or $(go env GOPATH)/bin
40+
# Create an alias for shorter command (optional)
41+
echo 'alias cco="claude-code-open"' >> ~/.bashrc # or ~/.zshrc
42+
source ~/.bashrc # or ~/.zshrc
43+
44+
# Or create a symlink (Linux/macOS) - handles both GOBIN and GOPATH
45+
GOBIN_DIR=$(go env GOBIN)
46+
if [ -z "$GOBIN_DIR" ]; then
47+
GOBIN_DIR="$(go env GOPATH)/bin"
48+
fi
49+
sudo ln -s "$GOBIN_DIR/claude-code-open" /usr/local/bin/cco
50+
51+
# One-liner version:
52+
# sudo ln -s "$([ -n "$(go env GOBIN)" ] && go env GOBIN || echo "$(go env GOPATH)/bin")/claude-code-open" /usr/local/bin/cco
53+
```
54+
55+
#### Option 2: Build from Source
56+
2957
```bash
3058
# Clone the repository
31-
git clone https://github.com/your-username/claude-code-open
59+
git clone https://github.com/Davincible/claude-code-open
3260
cd claude-code-open
3361

34-
# Build the application
35-
go build -o cco .
62+
# Build with Make (creates 'cco' binary)
63+
make build
64+
sudo make install # Install to /usr/local/bin
3665

37-
# Install globally (optional)
66+
# Or build manually
67+
go build -o cco .
3868
sudo mv cco /usr/local/bin/
3969
```
4070

71+
#### Option 3: Install with Custom Binary Name
72+
73+
```bash
74+
# Install with go install and create symlink using Go environment
75+
go install github.com/Davincible/claude-code-open@latest
76+
GOBIN_DIR=$(go env GOBIN); [ -z "$GOBIN_DIR" ] && GOBIN_DIR="$(go env GOPATH)/bin"
77+
sudo ln -sf "$GOBIN_DIR/claude-code-open" /usr/local/bin/cco
78+
79+
# Or use go install with custom GOBIN (if you have write permissions)
80+
GOBIN=/usr/local/bin go install github.com/Davincible/claude-code-open@latest
81+
sudo mv /usr/local/bin/claude-code-open /usr/local/bin/cco
82+
83+
# Or install to a custom directory you own
84+
mkdir -p ~/.local/bin
85+
GOBIN=~/.local/bin go install github.com/Davincible/claude-code-open@latest
86+
ln -sf ~/.local/bin/claude-code-open ~/.local/bin/cco
87+
# Add ~/.local/bin to PATH if not already there
88+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
89+
```
90+
4191
### Quick Start with CCO_API_KEY
4292

4393
For the fastest setup, you can run without any configuration file using just the `CCO_API_KEY` environment variable:
@@ -49,8 +99,8 @@ For the fastest setup, you can run without any configuration file using just the
4999
export CCO_API_KEY="your-api-key-here"
50100

51101
# Start the router immediately - no config file needed!
52-
# Although you can create a config if you want to store your API keys for all providers. See cco config
53-
cco start
102+
# Although you can create a config if you want to store your API keys for all providers
103+
cco start # or claude-code-open start
54104

55105
# The API key will be used for whichever provider your model requests
56106
# e.g., if you use "openrouter,anthropic/claude-3.5-sonnet" -> key goes to OpenRouter
@@ -68,7 +118,7 @@ cco start
68118
For advanced setups with multiple API keys, generate a complete YAML configuration:
69119

70120
```bash
71-
cco config generate
121+
cco config generate # or claude-code-open config generate
72122
```
73123

74124
This creates `config.yaml` with all 5 supported providers and sensible defaults. Then edit the file to add your API keys:
@@ -91,33 +141,34 @@ providers:
91141
Alternatively, use the interactive setup:
92142

93143
```bash
94-
cco config init
144+
cco config init # or claude-code-open config init
95145
```
96146

97147
### Usage
98148

99149
Start the router service:
100150

101151
```bash
102-
cco start # For if you want to start the proxy server separately.
152+
cco start # or claude-code-open start
103153
```
104154

105155
Use Claude Code with the router:
106156

107157
```bash
108-
cco code [claude-code-arguments] # You can also run this directly without starting the server first, it will auto start
158+
cco code [claude-code-arguments] # or claude-code-open code [...]
159+
# You can also run this directly without starting the server first, it will auto start
109160
```
110161

111162
Check service status:
112163

113164
```bash
114-
cco status
165+
cco status # or claude-code-open status
115166
```
116167

117168
Stop the service:
118169

119170
```bash
120-
cco stop
171+
cco stop # or claude-code-open stop
121172
```
122173

123174
## Dynamic Model Selection
@@ -280,42 +331,42 @@ Model format: `provider_name/model_name` (e.g., `openai/gpt-4o`, `anthropic/clau
280331

281332
```bash
282333
# Start the router service
283-
cco start [--verbose] [--log-file]
334+
cco start [--verbose] [--log-file] # or claude-code-open start [...]
284335

285336
# Stop the router service
286-
cco stop
337+
cco stop # or claude-code-open stop
287338

288339
# Check service status
289-
cco status
340+
cco status # or claude-code-open status
290341
```
291342

292343
### Configuration Management
293344

294345
```bash
295346
# Generate example YAML configuration with all providers
296-
cco config generate
347+
cco config generate # or claude-code-open config generate
297348

298349
# Generate and overwrite existing configuration
299-
cco config generate --force
350+
cco config generate --force # or claude-code-open config generate --force
300351

301352
# Initialize configuration interactively
302-
cco config init
353+
cco config init # or claude-code-open config init
303354

304355
# Show current configuration (displays format: YAML/JSON)
305-
cco config show
356+
cco config show # or claude-code-open config show
306357

307358
# Validate configuration
308-
cco config validate
359+
cco config validate # or claude-code-open config validate
309360
```
310361

311362
### Claude Code Integration
312363

313364
```bash
314365
# Run Claude Code through the router
315-
cco code [args...]
366+
cco code [args...] # or claude-code-open code [args...]
316367

317368
# Examples:
318-
cco code --help
369+
cco code --help # or claude-code-open code --help
319370
cco code "Write a Python script to sort a list"
320371
cco code --resume session-name
321372
```
@@ -487,6 +538,11 @@ After=network.target
487538
Type=simple
488539
User=your-user
489540
ExecStart=/usr/local/bin/cco start
541+
# Or if using go install without symlink:
542+
# ExecStart=%h/go/bin/claude-code-open start
543+
# Or with dynamic Go path:
544+
# ExecStartPre=/usr/bin/env bash -c 'echo "GOPATH: $(go env GOPATH)"'
545+
# ExecStart=/usr/bin/env bash -c '"$(go env GOPATH)/bin/claude-code-open" start'
490546
Restart=always
491547
RestartSec=5
492548

@@ -560,9 +616,9 @@ The router provides basic operational metrics through logs:
560616
### Common Issues
561617

562618
**Service won't start:**
563-
- Check configuration with `cco config validate`
619+
- Check configuration with `cco config validate` (or `claude-code-open config validate`)
564620
- Ensure port is available with `netstat -ln | grep :6970`
565-
- Check logs with `cco start --verbose`
621+
- Check logs with `cco start --verbose` (or `claude-code-open start --verbose`)
566622

567623
**Authentication errors:**
568624
- Verify provider API keys in configuration
@@ -582,7 +638,7 @@ The router provides basic operational metrics through logs:
582638
### Debug Mode
583639

584640
```bash
585-
cco start --verbose
641+
cco start --verbose # or claude-code-open start --verbose
586642
```
587643

588644
This enables detailed logging of:

0 commit comments

Comments
 (0)