> ## Documentation Index
> Fetch the complete documentation index at: https://www.edenai.co/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Use Open Code Review with Eden AI

> Set up Open Code Review (ocr) with its built-in Eden AI provider to run AI code reviews on your git diffs with any model and one API key.

**Use Open Code Review with Eden AI**

Set up Open Code Review (ocr) with its built-in Eden AI provider to run AI code reviews on your git diffs with any model and one API key.

`ocr` has an `edenai` provider preset, so setup is a key and a model id.

## Overview

Open Code Review (`ocr`) is Alibaba's open-source command-line code reviewer. It reads your git diffs and runs an LLM agent that can read full files and search the codebase, then writes review comments. `ocr review` covers a diff and `ocr scan` covers whole files. The agent sends tool definitions with every request, so the model you choose must support function calling.

## Prerequisites

* An Eden AI API key from [app.edenai.run](https://app.edenai.run)
* `ocr` installed:

```bash npm theme={null}
npm install -g @alibaba-group/open-code-review
```

```bash Install script theme={null}
curl -fsSL https://open-codereview.ai/install.sh | sh
```

## Setup

Select the provider and a model:

```bash CLI theme={null}
ocr config set provider edenai
ocr config set providers.edenai.model anthropic/claude-sonnet-latest
```

```bash Interactive theme={null}
ocr config provider   # select "edenai"
ocr config model      # pick an Eden AI model
```

Then give `ocr` your key. It reads `EDENAI_API_KEY` from the environment when no key is stored in its config:

```bash Terminal theme={null}
export EDENAI_API_KEY="YOUR_API_KEY"
```

To store the key in the `ocr` config instead, run `ocr config set providers.edenai.api_key YOUR_API_KEY`. A stored key takes precedence over the environment variable, and `ocr` does not read `.env` files.

Check the connection, then review your changes:

```bash Terminal theme={null}
ocr llm test
ocr review
```

The `edenai` preset supplies the base URL `https://api.edenai.run/v3` and the OpenAI-compatible protocol. `ocr llm providers` lists every built-in provider.

## Model naming

Use the full `provider/model` id as the model, for example `anthropic/claude-sonnet-latest`, `openai/gpt-latest` or `mistral/mistral-large-latest`. Aliases ending in `-latest` follow the newest model of a family. See [Listing models](https://www.edenai.co/docs/v3/llms/listing-models.md) for the ids and their capabilities.

`ocr` lists suggested models for `ocr config model`, but they are suggestions, not restrictions: a `--model` override outside the list only prints a warning on stderr.

## Switching models

Run `ocr config model`, or set the model directly:

```bash Terminal theme={null}
ocr config set providers.edenai.model openai/gpt-latest
```

## Troubleshooting

### Authentication errors (401)

Confirm the key at [app.edenai.run](https://app.edenai.run) under **API Keys**. If you stored a key with `ocr config set`, it overrides `EDENAI_API_KEY`, so overwrite it with `ocr config set providers.edenai.api_key YOUR_API_KEY`. A 401 with `Invalid API key` means the `sk-eden-...` key is wrong or revoked; `Invalid token` means the credential is not an Eden AI key at all.

### The review fails on tool calls

`ocr` sends tool definitions with every request. Use a model that supports function calling, such as the ones on this page.

## Next Steps

* [Chat Completions](https://www.edenai.co/docs/v3/llms/chat-completions.md) - Core LLM endpoint
* [List LLM Models](https://www.edenai.co/docs/v3/llms/listing-models.md) - Browse available providers and models
* [OpenAI SDK (Python)](https://www.edenai.co/docs/v3/integrations/openai-sdk-python.md) - Direct SDK usage


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.