OpenCodeReview
Use aicentos in OpenCodeReview (OCR) — wire up code review through a custom provider
Last updated:
OpenCodeReview (command name ocr) is Alibaba's open-source AI code review CLI: it reads the Git diff and calls a large model for review comments. It ships with an OpenAI-compatible provider and also supports custom OpenAI-compatible gateways, so requests can be routed to aicentos.
Prerequisites
Create a dedicated key in the aicentos console (naming it ocr-ci makes usage easier to track). OCR only supports the OpenAI and Anthropic protocols; this guide uses OpenAI's Chat Completions path. Code review depends on the model's function calling capability, so pick a model that supports tool calling.
Configuration to fill in
| Field | Value |
|---|---|
| provider | openai (built-in, override its URL) or a custom provider |
| protocol | openai (Chat Completions) |
| URL | https://aicentos.com/v1 |
| API Key | The key created in the console |
| Model | A model name from the Model Gallery in the console; must support function calling |
Setup steps
-
Install the CLI (Node.js required, or Homebrew on macOS):
npm install -g open-code-review -
Write the configuration with the non-interactive commands; it ends up in
~/.opencodereview/config.json:ocr config set provider openai ocr config set model claude-sonnet-5 ocr config set providers.openai.url https://aicentos.com/v1 ocr config set providers.openai.api_key your_api_key_here -
If you prefer a graphical walkthrough, run
ocr config providerandocr config modelinstead: pick the provider, enter the key and choose the model in the TUI, and a connectivity check runs automatically at the end.
Test
Verify the endpoint on its own first:
ocr llm testOnce it passes, run a real review in any Git repository:
ocr reviewNotes
- The URL only goes up to
/v1; do not extend it to the full/chat/completions. - The configuration resolver needs all three of URL, key and model; merely
exporting environment variables is not enough — anything missing must still be written into config.json, otherwise you get a 401. - Environment variables can also override the configuration temporarily and take the highest precedence:
OCR_LLM_URL/OCR_LLM_TOKEN/OCR_LLM_MODEL. - For the built-in provider the field is
providers.<name>.url; for custom providers it iscustom_providers.<name>.url. Do not mix up the two maps. - An insufficient account balance shows up as 401 / 403; check the balance on the wallet page first.
- Official repository:
https://github.com/alibaba/open-code-review