Skip to content

Commit 90faa6e

Browse files
Backport PR #1193: Update documentation to add usage of Openrouter (#1195)
Co-authored-by: Sanjiv Das <[email protected]>
1 parent 221c78f commit 90faa6e

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

docs/source/_static/ai-settings.png

89.8 KB
Loading
234 KB
Loading
172 KB
Loading

docs/source/users/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,13 @@ Jupyter AI enables use of language models hosted on [Amazon Bedrock](https://aws
339339
For details on enabling model access in your AWS account, using cross-region inference, or invoking custom/provisioned models, please see our dedicated documentation page on [using Amazon Bedrock in Jupyter AI](bedrock.md).
340340

341341

342+
### OpenRouter Usage
343+
344+
Jupyter AI enables use of language models accessible through [OpenRouter](https://openrouter.ai)'s unified interface. Examples of models that may be accessed via OpenRouter are: [Deepseek](https://openrouter.ai/deepseek/deepseek-chat), [Qwen](https://openrouter.ai/qwen/), [mistral](https://openrouter.ai/mistralai/), etc. OpenRouter enables usage of any model conforming to the OpenAI API.
345+
346+
For details on enabling model access via the AI Settings and using models via OpenRouter, please see the dedicated documentation page on using [OpenRouter in Jupyter AI](openrouter.md).
347+
348+
342349
### SageMaker endpoints usage
343350

344351
Jupyter AI supports language models hosted on SageMaker endpoints that use JSON

docs/source/users/openrouter.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Using OpenRouter in Jupyter AI
2+
3+
[(Return to the Chat Interface page)](index.md#openrouter-usage)
4+
5+
For models that are compatible with the OpenAI library, Jupyter AI provides configuration via OpenRouter. By supporting the configuration of parameters such as the api_key, base_url, and model, various large model services compatible with the OpenAI library call methods can be used. For more details on OpenRouter as a unified interface for LLMs, see https://openrouter.ai/.
6+
7+
As an example, we walk through the steps needed to use models from [Deepseek](https://www.deepseek.com) via the OpenRouter provider. If you do not have `langchain-openai` installed, please install it and restart JupyterLab. This is necessary as it provides the SDK for accessing any OpenAI API.
8+
9+
First, navigate to the `AI Settings` pane via the AI settings button in `v2` or via the dropdown in `v3` of Jupyter AI, as shown below:
10+
11+
<img src="../_static/ai-settings.png"
12+
width="75%"
13+
alt='Screenshot of the dropdown where AI Settings is chosen and it opens tab in Jupyter AI where models are selected.'
14+
class="screenshot" />
15+
16+
Second, select the `OpenRouter :: *` model provider in the Jupyter AI settings. If you don't see this, please verify that you have installed `langchain-openai` and that you are using `jupyter_ai>=2.24.0`. Be sure to restart JupyterLab after upgrading or installing either package.
17+
18+
Jupyter AI's settings page with the OpenRouter provider selected is shown below:
19+
20+
<img src="../_static/openrouter-model-setup.png"
21+
width="75%"
22+
alt='Screenshot of the tab in Jupyter AI where OpenRouter model access is selected.'
23+
class="screenshot" />
24+
25+
Type in the model name and the API base URL corresponding to the model you wish to use. For Deepseek, you should use `https://api.deepseek.com` as the API base URL, and use `deepseek-chat` as the local model ID.
26+
27+
If you are using OpenRouter for the first time it will also require entering the `OPENROUTER_API_KEY`. If you have used OpenRouter before with a different model provider, you will need to update the API key. After doing this, click "Save Changes" at the bottom to save your settings.
28+
29+
You should now be able to use Deepseek! An example of usage is shown next:
30+
31+
<img src="../_static/openrouter-chat.png"
32+
width="75%"
33+
alt='Screenshot of chat using Deepseek via the OpenRouter provider.'
34+
class="screenshot" />
35+
36+
[(Return to the Chat Interface page)](index.md#openrouter-usage)

0 commit comments

Comments
 (0)