Skip to content

Commit d939b32

Browse files
docs: rewrite LLM config section to use provider-based setup
Replace the legacy manual `llm.*` configuration with the modern provider system across all README localizations (en, zh-CN, ja-JP, ko-KR, ru-RU). The new structure introduces interactive setup for humans and CLI-based `ocr config set` commands for CI/CD, covering both built-in and custom providers.
1 parent 52da795 commit d939b32

6 files changed

Lines changed: 194 additions & 89 deletions

File tree

README.ja-JP.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ sudo cp dist/opencodereview /usr/local/bin/ocr
162162

163163
**コードレビューの前に必ずLLMを設定する必要があります。**
164164

165+
OCRは統一された**プロバイダー(Provider)**システムでLLM設定を管理します。多数の主要プロバイダーが組み込まれており、プライベートデプロイメントやその他の互換エンドポイントに接続するためのカスタムプロバイダーの追加もサポートしています。設定は`~/.opencodereview/config.json`に保存されます。
166+
165167
**オプションA: 対話的セットアップ(推奨)**
166168

167169
```bash
@@ -171,26 +173,47 @@ ocr config model # アクティブなプロバイダーのモデル
171173

172174
![Provider setup](imgs/providers.jpg)
173175

174-
**オプションB: 手動設定**
176+
対話的UIがプロバイダーの選択、APIキーの入力、モデル設定をガイドし、完了後に自動的に接続テストを行います。
177+
178+
`ocr llm providers`を実行すると、すべてのビルトインプロバイダーを確認できます。ビルトインプロバイダーにはAPI URLとプロトコルがプリセットされているため、APIキーを提供するだけで使用できます。対応する環境変数(例:`ANTHROPIC_API_KEY``OPENAI_API_KEY`)が設定済みの場合、APIキーは自動的に読み取られます。
179+
180+
**カスタムプロバイダー**も対話的UIから追加できます — プロバイダー名、API URL、プロトコルタイプ(`anthropic`または`openai`)、APIキーを入力します。
181+
182+
**オプションB: CLIセットアップ(CI/CDなど非対話環境向け)**
183+
184+
`ocr config set`コマンドでプロバイダー設定を直接書き込みます。スクリプトや自動化に適しています。
185+
186+
ビルトインプロバイダーを使用する場合:
175187

176188
```bash
177-
ocr config set llm.url https://api.anthropic.com/v1/messages
178-
ocr config set llm.auth_token your-api-key-here
179-
ocr config set llm.model claude-opus-4-6
180-
ocr config set llm.use_anthropic true
189+
ocr config set provider anthropic
190+
ocr config set providers.anthropic.api_key your-api-key-here
191+
ocr config set providers.anthropic.model claude-sonnet-4-6
181192
```
182193

183-
設定は`~/.opencodereview/config.json`に保存されます。
184-
185-
**`auth_header`(オプション):** Anthropic使用時にAPIキーを送信するHTTPヘッダーを制御します。省略時のデフォルトは`authorization`(Bearerトークン)です。標準の`sk-ant-*` APIキーを使用する場合は、`x-api-key`に設定する必要があります:
194+
カスタムプロバイダーを使用する場合(プライベートゲートウェイやその他の互換エンドポイント):
186195

187196
```bash
188-
ocr config set llm.auth_header x-api-key
197+
ocr config set provider my-gateway
198+
ocr config set custom_providers.my-gateway.url https://my-llm-gateway.internal/v1
199+
ocr config set custom_providers.my-gateway.protocol openai
200+
ocr config set custom_providers.my-gateway.api_key your-api-key-here
201+
ocr config set custom_providers.my-gateway.model gpt-4o
189202
```
190203

191-
サポートされる値:`x-api-key``authorization`(エイリアス:`bearer`)。それ以外の値はエラーになります。
204+
> カスタムプロバイダーでは`url``protocol`が必須です。サポートされるプロトコル:`anthropic``openai`
205+
206+
オプション設定:
207+
208+
| キー | 説明 |
209+
|------|------|
210+
| `providers.<name>.auth_header` | 認証ヘッダー:`x-api-key`または`authorization`(デフォルト:`authorization`|
211+
| `providers.<name>.extra_body` | リクエストボディにマージされるカスタムJSONフィールド |
212+
| `providers.<name>.models` | 対話的選択用のモデルリスト |
213+
214+
**環境変数(最優先)**
192215

193-
**オプションC: 環境変数(最優先)**
216+
環境変数は設定ファイルの設定を上書きします。設定ファイルの書き込みが不便なCI/CDシナリオに適しています:
194217

195218
```bash
196219
export OCR_LLM_URL=https://api.anthropic.com/v1/messages
@@ -199,14 +222,12 @@ export OCR_LLM_MODEL=claude-opus-4-6
199222
export OCR_USE_ANTHROPIC=true
200223
```
201224

202-
また、Claude Codeの環境変数(`ANTHROPIC_BASE_URL``ANTHROPIC_AUTH_TOKEN``ANTHROPIC_MODEL`)とも互換性があり、`~/.zshrc` / `~/.bashrc`からこれらのexportをパースします。
225+
Claude Codeの環境変数(`ANTHROPIC_BASE_URL``ANTHROPIC_AUTH_TOKEN``ANTHROPIC_MODEL`)とも互換性があり、`~/.zshrc` / `~/.bashrc`からこれらのexportをパースします。
203226

204-
> **CC-Switchユーザー向けの注意**: [CC-Switch](https://github.com/farion1231/cc-switch)[ルーティングサービス](https://www.ccswitch.io/en/docs?section=proxy&item=service)有効で使用している場合、追加設定なしで`llm.url`をCC-Switchのプロキシアドレスに向けることができます:
205-
> - **Claude**プロバイダーの場合: `llm.url``http://127.0.0.1:15721`に設定
206-
> - **Codex**プロバイダーの場合: `llm.url``http://127.0.0.1:15721/v1`に設定
207-
> - `llm.model`はプロバイダー設定に応じて設定
208-
> - `llm.auth_token`は任意の値で構いません
209-
> - `extra_body`設定は引き続き有効です
227+
> **CC-Switchユーザー向けの注意**: [CC-Switch](https://github.com/farion1231/cc-switch)[ルーティングサービス](https://www.ccswitch.io/en/docs?section=proxy&item=service)有効で使用している場合、プロバイダーの`url`をCC-Switchのプロキシアドレスに向けることで、追加設定なしで利用できます:
228+
> - **Claude**プロバイダーの場合:`providers.anthropic.url``http://127.0.0.1:15721`に設定
229+
> - **Codex**プロバイダーの場合:対応するプロバイダーの`url``http://127.0.0.1:15721/v1`に設定
230+
> - `api_key`は任意の値で構いません。`extra_body`設定は引き続き有効です
210231
211232
**2. 疎通テスト**
212233

README.ko-KR.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ sudo cp dist/opencodereview /usr/local/bin/ocr
162162

163163
**코드 리뷰를 실행하기 전에 반드시 LLM을 설정해야 합니다.**
164164

165+
OCR은 통합 **Provider** 시스템으로 LLM 설정을 관리합니다. 다양한 주요 provider가 내장되어 있으며, 프라이빗 배포 또는 기타 호환 엔드포인트에 연결하기 위한 커스텀 provider 추가도 지원합니다. 설정은 `~/.opencodereview/config.json`에 저장됩니다.
166+
165167
**Option A: 대화형 설정 (권장)**
166168

167169
```bash
@@ -171,26 +173,47 @@ ocr config model # 활성 provider의 model 선택
171173

172174
![Provider setup](imgs/providers.jpg)
173175

174-
**Option B: 수동 설정**
176+
대화형 UI가 provider 선택, API key 입력, model 설정을 안내하며, 완료 후 자동으로 연결 테스트를 수행합니다.
177+
178+
`ocr llm providers`를 실행하면 모든 built-in provider를 확인할 수 있습니다. Built-in provider에는 API URL과 프로토콜이 사전 설정되어 있어 API key만 제공하면 바로 사용할 수 있습니다. 해당 환경 변수(예: `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`)가 이미 설정되어 있으면 API key가 자동으로 읽힙니다.
179+
180+
**커스텀 provider**도 대화형 UI에서 추가할 수 있습니다 — provider 이름, API URL, 프로토콜 타입(`anthropic` 또는 `openai`), API key를 입력합니다.
181+
182+
**Option B: CLI 설정 (CI/CD 등 비대화형 환경용)**
183+
184+
`ocr config set` 명령으로 provider 설정을 직접 작성합니다. 스크립트 및 자동화에 적합합니다.
185+
186+
Built-in provider 사용:
175187

176188
```bash
177-
ocr config set llm.url https://api.anthropic.com/v1/messages
178-
ocr config set llm.auth_token your-api-key-here
179-
ocr config set llm.model claude-opus-4-6
180-
ocr config set llm.use_anthropic true
189+
ocr config set provider anthropic
190+
ocr config set providers.anthropic.api_key your-api-key-here
191+
ocr config set providers.anthropic.model claude-sonnet-4-6
181192
```
182193

183-
config는 `~/.opencodereview/config.json`에 저장됩니다.
184-
185-
**`auth_header` (선택사항):** Anthropic 사용 시 API key를 전송할 HTTP header를 제어합니다. 생략하면 기본값은 `authorization` (Bearer token)입니다. 표준 `sk-ant-*` API key를 사용하는 경우 `x-api-key`로 설정해야 합니다:
194+
커스텀 provider 사용 (프라이빗 게이트웨이 또는 기타 호환 엔드포인트):
186195

187196
```bash
188-
ocr config set llm.auth_header x-api-key
197+
ocr config set provider my-gateway
198+
ocr config set custom_providers.my-gateway.url https://my-llm-gateway.internal/v1
199+
ocr config set custom_providers.my-gateway.protocol openai
200+
ocr config set custom_providers.my-gateway.api_key your-api-key-here
201+
ocr config set custom_providers.my-gateway.model gpt-4o
189202
```
190203

191-
지원되는 값: `x-api-key`, `authorization` (별칭: `bearer`). 그 외 값은 오류로 처리됩니다.
204+
> 커스텀 provider에서는 `url``protocol`이 필수입니다. 지원 프로토콜: `anthropic`, `openai`.
205+
206+
선택 설정:
207+
208+
|| 설명 |
209+
|----|------|
210+
| `providers.<name>.auth_header` | 인증 header: `x-api-key` 또는 `authorization` (기본값: `authorization`) |
211+
| `providers.<name>.extra_body` | 요청 body에 병합되는 커스텀 JSON 필드 |
212+
| `providers.<name>.models` | 대화형 선택용 model 목록 |
213+
214+
**환경 변수 (가장 높은 우선순위)**
192215

193-
**Option C: 환경 변수(가장 높은 우선순위)**
216+
환경 변수는 설정 파일의 값을 덮어씁니다. 설정 파일 작성이 불편한 CI/CD 시나리오에 적합합니다:
194217

195218
```bash
196219
export OCR_LLM_URL=https://api.anthropic.com/v1/messages
@@ -201,12 +224,10 @@ export OCR_USE_ANTHROPIC=true
201224

202225
Claude Code 환경 변수(`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_MODEL`)와도 호환되며, `~/.zshrc` / `~/.bashrc`의 export도 파싱합니다.
203226

204-
> **CC-Switch 사용자 참고**: [CC-Switch](https://github.com/farion1231/cc-switch)[routing service](https://www.ccswitch.io/en/docs?section=proxy&item=service)와 함께 사용한다면, 추가 설정 없이 `llm.url`을 CC-Switch proxy 주소로 지정할 수 있습니다.
205-
> - **Claude** provider: `llm.url``http://127.0.0.1:15721`로 설정
206-
> - **Codex** provider: `llm.url``http://127.0.0.1:15721/v1`로 설정
207-
> - provider 설정에 맞게 `llm.model` 설정
208-
> - `llm.auth_token`은 아무 값이나 사용할 수 있음
209-
> - `extra_body` 설정은 그대로 적용됨
227+
> **CC-Switch 사용자 참고**: [CC-Switch](https://github.com/farion1231/cc-switch)[routing service](https://www.ccswitch.io/en/docs?section=proxy&item=service)와 함께 사용한다면, provider의 `url`을 CC-Switch proxy 주소로 지정하여 추가 설정 없이 사용할 수 있습니다:
228+
> - **Claude** provider: `providers.anthropic.url``http://127.0.0.1:15721`로 설정
229+
> - **Codex** provider: 해당 provider의 `url``http://127.0.0.1:15721/v1`로 설정
230+
> - `api_key`는 아무 값이나 사용 가능, `extra_body` 설정은 그대로 적용됨
210231
211232
**2. 연결 테스트**
212233

README.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ sudo cp dist/opencodereview /usr/local/bin/ocr
162162

163163
**You must configure an LLM before reviewing code.**
164164

165+
OCR manages LLM configuration through a unified **Provider** system. It ships with many popular built-in providers and also supports adding custom providers to connect to private deployments or other compatible endpoints. Config is stored in `~/.opencodereview/config.json`.
166+
165167
**Option A: Interactive setup (Recommended)**
166168

167169
```bash
@@ -171,26 +173,47 @@ ocr config model # Pick a model for the active provider
171173

172174
![Provider setup](imgs/providers.jpg)
173175

174-
**Option B: Manual config**
176+
The interactive UI guides you through provider selection, API key entry, and model configuration, then automatically tests connectivity.
177+
178+
Run `ocr llm providers` to see all built-in providers. Built-in providers come with preset API URLs and protocols — just supply an API key to get started. If the corresponding environment variable is already set (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`), the API key is picked up automatically.
179+
180+
**Custom providers** can also be added through the interactive UI — you'll need to provide a name, API URL, protocol type (`anthropic` or `openai`), and API key.
181+
182+
**Option B: CLI setup (for CI/CD and non-interactive environments)**
183+
184+
Use `ocr config set` to write provider configuration directly, suitable for scripts and automation.
185+
186+
Using a built-in provider:
175187

176188
```bash
177-
ocr config set llm.url https://api.anthropic.com/v1/messages
178-
ocr config set llm.auth_token your-api-key-here
179-
ocr config set llm.model claude-opus-4-6
180-
ocr config set llm.use_anthropic true
189+
ocr config set provider anthropic
190+
ocr config set providers.anthropic.api_key your-api-key-here
191+
ocr config set providers.anthropic.model claude-sonnet-4-6
181192
```
182193

183-
Config is stored in `~/.opencodereview/config.json`.
184-
185-
**`auth_header` (optional):** Controls which HTTP header carries the API key when using Anthropic. Defaults to `authorization` (Bearer token) if omitted. If you use a standard `sk-ant-*` API key, you must set it to `x-api-key`:
194+
Using a custom provider (private gateway or other compatible endpoint):
186195

187196
```bash
188-
ocr config set llm.auth_header x-api-key
197+
ocr config set provider my-gateway
198+
ocr config set custom_providers.my-gateway.url https://my-llm-gateway.internal/v1
199+
ocr config set custom_providers.my-gateway.protocol openai
200+
ocr config set custom_providers.my-gateway.api_key your-api-key-here
201+
ocr config set custom_providers.my-gateway.model gpt-4o
189202
```
190203

191-
Supported values: `x-api-key`, `authorization` (alias: `bearer`). Other values are rejected with an error.
204+
> `url` and `protocol` are required for custom providers. Supported protocols: `anthropic`, `openai`.
205+
206+
Optional settings:
207+
208+
| Key | Description |
209+
|-----|-------------|
210+
| `providers.<name>.auth_header` | Auth header: `x-api-key` or `authorization` (default: `authorization`) |
211+
| `providers.<name>.extra_body` | Custom JSON fields merged into the request body |
212+
| `providers.<name>.models` | Model list for interactive selection |
213+
214+
**Environment variables (highest priority)**
192215

193-
**Option C: Environment variables (highest priority)**
216+
Environment variables override config file settings, useful in CI/CD where writing config files is inconvenient:
194217

195218
```bash
196219
export OCR_LLM_URL=https://api.anthropic.com/v1/messages
@@ -199,14 +222,12 @@ export OCR_LLM_MODEL=claude-opus-4-6
199222
export OCR_USE_ANTHROPIC=true
200223
```
201224

202-
It is also compatible with Claude Code environment variables (`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_MODEL`) and parses `~/.zshrc` / `~/.bashrc` for those exports.
225+
Also compatible with Claude Code environment variables (`ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_MODEL`) and parses `~/.zshrc` / `~/.bashrc` for those exports.
203226

204-
> **Note for CC-Switch Users**: If you are using [CC-Switch](https://github.com/farion1231/cc-switch) with [routing service](https://www.ccswitch.io/en/docs?section=proxy&item=service) enabled, you can point `llm.url` to the CC-Switch proxy address without additional configuration:
205-
> - For **Claude** provider: set `llm.url` to `http://127.0.0.1:15721`
206-
> - For **Codex** provider: set `llm.url` to `http://127.0.0.1:15721/v1`
207-
> - Set `llm.model` according to your provider settings
208-
> - `llm.auth_token` can be any value
209-
> - `extra_body` settings still apply
227+
> **Note for CC-Switch Users**: If you are using [CC-Switch](https://github.com/farion1231/cc-switch) with [routing service](https://www.ccswitch.io/en/docs?section=proxy&item=service) enabled, you can point the provider's `url` to the CC-Switch proxy address without additional configuration:
228+
> - For **Claude** provider: set `providers.anthropic.url` to `http://127.0.0.1:15721`
229+
> - For **Codex** provider: set the corresponding provider's `url` to `http://127.0.0.1:15721/v1`
230+
> - `api_key` can be any value; `extra_body` settings still apply
210231
211232
**2. Test Connectivity**
212233

0 commit comments

Comments
 (0)