Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clarity on how to add openrouter for llm-support #1509

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
clarity on how to add openrouter for llm-support
lshalon committed Mar 13, 2025

Verified

This commit was signed with the committer’s verified signature.
commit 0d0b3f2b0b599ef8e00e7319102fa29a0b3c6912
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -119,6 +119,61 @@ You can find a lot more about configuring Grist, setting up authentication,
and running it on a public server in our
[Self-Managed Grist](https://support.getgrist.com/self-managed/) handbook.

## Using Grist with OpenRouter for Model Agnostic and Claude Support

Grist's AI Formula Assistant can be configured to use OpenRouter instead of connecting directly to OpenAI, allowing you to access a wide range of AI models including Anthropic's Claude models. This isn't the only way to use Claude models, but it's a good option if you want to use Claude models with Grist or intend to use other cheaper, faster, or potentially newer models. That's because this configuration gives you more flexibility in choosing the AI model that works best for your formula generation needs.
To set up OpenRouter integration, configure the following environment variables:

### Required: Set the endpoint to OpenRouter's API

```
ASSISTANT_CHAT_COMPLETION_ENDPOINT=https://openrouter.ai/api/v1/chat/completions
```

### Required: Your OpenRouter API key

```
ASSISTANT_API_KEY=your_openrouter_api_key_here
```

Sign up for an OpenRouter API key at <https://openrouter.ai/>

### Optional: Specify which model to use (examples below)

```
ASSISTANT_MODEL=anthropic/claude-3.7-sonnet
```

### or other options like

```
ASSISTANT_MODEL=deepseek/deepseek-r1-zero:free
```

```
ASSISTANT_MODEL=qwen/qwq-32b:free
```

```
ASSISTANT_MODEL=mistralai/mistral-saba
```

### Optional: Set a larger context model for fallback

```
ASSISTANT_LONGER_CONTEXT_MODEL=anthropic/claude-3-opus-20240229
```

With this configuration, Grist's AI Formula Assistant will route requests through OpenRouter to your specified model. This allows you to:

Access Anthropic's Claude models which excel at understanding context and generating accurate formulas
Switch between different AI models without changing your Grist configuration
Take advantage of OpenRouter's routing capabilities to optimize for cost, speed, or quality

You can find the available models and their identifiers on the OpenRouter website.
Note: Make sure not to set the OPENAI_API_KEY variable when using OpenRouter, as this would override the OpenRouter configuration.


## Available Docker images

The default Docker image is `gristlabs/grist`. This contains all of