| 1 | import TabItem from "@theme/TabItem"; |
| 2 | import Tabs from "@theme/Tabs"; |
| 3 | |
| 4 | # OpenRouter |
| 5 | |
| 6 | OpenRouter is a unified interface for commercial and open-source models, giving you access to the best models at the best prices. You can sign up [here](https://openrouter.ai/signup), create your API key on the [keys page](https://openrouter.ai/keys), and then choose a model from the [list of supported models](https://openrouter.ai/models). |
| 7 | |
| 8 | Change `~/.continue/config.json` to look like the following. |
| 9 | |
| 10 | <Tabs groupId="config-example"> |
| 11 | <TabItem value="yaml" label="YAML"> |
| 12 | ```yaml title="config.yaml" |
| 13 | models: |
| 14 | - name: OpenRouter LLaMA 70 8B |
| 15 | provider: openrouter |
| 16 | model: meta-llama/llama-3-70b-instruct |
| 17 | apiBase: https://openrouter.ai/api/v1 |
| 18 | apiKey: <YOUR_OPEN_ROUTER_API_KEY> |
| 19 | ``` |
| 20 | </TabItem> |
| 21 | <TabItem value="json" label="JSON"> |
| 22 | ```json title="config.json" |
| 23 | { |
| 24 | "models": [ |
| 25 | { |
| 26 | "title": "OpenRouter LLaMA 70 8B", |
| 27 | "provider": "openrouter", |
| 28 | "model": "meta-llama/llama-3-70b-instruct", |
| 29 | "apiBase": "https://openrouter.ai/api/v1", |
| 30 | "apiKey": "<YOUR_OPEN_ROUTER_API_KEY>" |
| 31 | } |
| 32 | ] |
| 33 | } |
| 34 | ``` |
| 35 | </TabItem> |
| 36 | </Tabs> |
| 37 | |
| 38 | To utilize features such as provider preferences or model routing configuration, include these parameters inside the `models[].requestsOptions.extraBodyProperties` field of your plugin config. |
| 39 | |
| 40 | For example, to prevent extra long prompts from being compressed, you can explicitly turn off the feature like so: |
| 41 | |
| 42 | <Tabs groupId="config-example"> |
| 43 | <TabItem value="yaml" label="YAML"> |
| 44 | ```yaml title="config.yaml" |
| 45 | models: |
| 46 | - name: Example Model |
| 47 | provider: exampleProvider |
| 48 | model: example-model |
| 49 | requestOptions: |
| 50 | extraBodyProperties: |
| 51 | transforms: [] |
| 52 | ``` |
| 53 | </TabItem> |
| 54 | <TabItem value="json" label="JSON"> |
| 55 | ```json title="config.json" |
| 56 | { |
| 57 | "models": [ |
| 58 | { |
| 59 | "title": "Example Model", |
| 60 | "provider": "exampleProvider", |
| 61 | "model": "example-model", |
| 62 | "requestOptions": { |
| 63 | "extraBodyProperties": { |
| 64 | "transforms": [] |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | ] |
| 69 | } |
| 70 | ``` |
| 71 | </TabItem> |
| 72 | </Tabs> |
| 73 | |
| 74 | Learn more about available settings [here](https://openrouter.ai/docs). |