docs: add integrate OpenRouter with Jan (#1495)

Docs to integrate OpenRouter with Jan without UI/UX
This commit is contained in:
Hieu 2024-01-11 17:37:42 +07:00 committed by GitHub
commit 93105ab1d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 80 additions and 0 deletions

View File

@ -0,0 +1,80 @@
---
title: Integrate OpenRouter with Jan
slug: /guides/integrations/openrouter
description: Guide to integrate OpenRouter with Jan
keywords:
[
Jan AI,
Jan,
ChatGPT alternative,
local AI,
private AI,
conversational AI,
no-subscription fee,
large language model,
OpenRouter integration,
]
---
## Quick Introduction
[OpenRouter](https://openrouter.ai/docs#quick-start) is an AI model aggregator. The API can be used by developers to interact with a variety of large language models, generative image models, and generative 3D object models.
In this guide, we will show you how to integrate OpenRouter with Jan, enabling you to leverage remote Large Language Models (LLM) that are available at OpenRouter.
## Steps to Integrate OpenRouter with Jan
### 1. Configure OpenRouter API key
You can find your API keys in the [OpenRouter API Key](https://openrouter.ai/keys) and set the OpenRouter API key in `~/jan/engines/openai.json` file.
```json title="~/jan/engines/openai.json"
{
// highlight-start
"full_url": "https://openrouter.ai/api/v1/chat/completions",
"api_key": "sk-or-v1<your-openrouter-api-key-here>"
// highlight-end
}
```
### 2. Mofidy a Model JSON
Navigate to the `~/jan/models` folder. Create a folder named `<openrouter-modelname>`, for example, `openrouter-dolphin-mixtral-8x7b` and create a `model.json` file inside the folder including the following configurations:
- Ensure the filename must be `model.json`.
- Ensure the `id` property is set to the model id from OpenRouter.
- Ensure the `format` property is set to `api`.
- Ensure the `engine` property is set to `openai`.
- Ensure the `state` property is set to `ready`.
```json title="~/jan/models/openrouter-dolphin-mixtral-8x7b/model.json"
{
"source_url": "https://openrouter.ai/",
"id": "cognitivecomputations/dolphin-mixtral-8x7b",
"object": "model",
"name": "Dolphin 2.6 Mixtral 8x7B",
"version": "1.0",
"description": "This is a 16k context fine-tune of Mixtral-8x7b. It excels in coding tasks due to extensive training with coding data and is known for its obedience, although it lacks DPO tuning. The model is uncensored and is stripped of alignment and bias. It requires an external alignment layer for ethical use. Users are cautioned to use this highly compliant model responsibly, as detailed in a blog post about uncensored models at erichartford.com/uncensored-models.",
// highlight-next-line
"format": "api",
"settings": {},
"parameters": {},
"metadata": {
"tags": ["General", "Big Context Length"]
},
// highlight-start
"engine": "openai",
"state": "ready"
// highlight-end
}
```
### 3. Start the Model
Restart Jan and navigate to the Hub. Locate your model and click the Use button.
![Dolphin OpenRouter Model](assets/02-openrouter-dolphin.png)
### 4. Try Out the Integration of Jan and OpenRouter
![Dolphin OpenRouter Model Trial](assets/02-openrouter-dolphin-trial.gif)

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB