Elffuss BraidHub

kikocis/continue public

19cfb6ec829a · 3.7 KiBRawPermalink
1---
2title: "How to Configure OpenRouter with Continue"
3sidebarTitle: "OpenRouter"
4description: "Configure OpenRouter with Continue to access various commercial and open-source models through a unified interface, including model capability configuration and advanced request options"
5---
6
7OpenRouter 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).
8
9Change `~/.continue/config.json` to look like the following.
10
11<Tabs>
12 <Tab title="YAML">
13 ```yaml title="config.yaml"
14 models:
15 - name: OpenRouter LLaMA 70 8B
16 provider: openrouter
17 model: meta-llama/llama-3-70b-instruct
18 apiBase: https://openrouter.ai/api/v1
19 apiKey: <YOUR_OPEN_ROUTER_API_KEY>
20 ```
21 </Tab>
22 <Tab title="JSON">
23 ```json title="config.json"
24 {
25 "models": [
26 {
27 "title": "OpenRouter LLaMA 70 8B",
28 "provider": "openrouter",
29 "model": "meta-llama/llama-3-70b-instruct",
30 "apiBase": "https://openrouter.ai/api/v1",
31 "apiKey": "<YOUR_OPEN_ROUTER_API_KEY>"
32 }
33 ]
34 }
35 ```
36 </Tab>
37</Tabs>
38
39To utilize features such as provider preferences or model routing configuration, include these parameters inside the `models[].requestsOptions.extraBodyProperties` field of your plugin config.
40
41For example, to prevent extra long prompts from being compressed, you can explicitly turn off the feature like so:
42
43<Tabs>
44 <Tab title="YAML">
45 ```yaml title="config.yaml"
46 models:
47 - name: Example Model
48 provider: exampleProvider
49 model: example-model
50 requestOptions:
51 extraBodyProperties:
52 transforms: []
53 ```
54 </Tab>
55 <Tab title="JSON">
56 ```json title="config.json"
57 {
58 "models": [
59 {
60 "title": "Example Model",
61 "provider": "exampleProvider",
62 "model": "example-model",
63 "requestOptions": {
64 "extraBodyProperties": {
65 "transforms": []
66 }
67 }
68 }
69 ]
70 }
71 ```
72 </Tab>
73</Tabs>
74
75Learn more about available settings [here](https://openrouter.ai/docs).
76
77## Model Capabilities
78
79OpenRouter models may require explicit capability configuration because the proxy doesn't always preserve the original model's function calling support.
80
81<Info>
82 Continue automatically uses system message tools for models that don't support
83 native function calling, so Agent mode should work even without explicit
84 capability configuration. However, you can still override capabilities if
85 needed.
86</Info>
87
88If you're experiencing issues with Agent mode or tools not working, you can add the capabilities field:
89
90<Tabs>
91 <Tab title="YAML">
92 ```yaml title="config.yaml"
93 models:
94 - name: Claude via OpenRouter
95 provider: openrouter
96 model: anthropic/claude-3.5-sonnet
97 apiBase: https://openrouter.ai/api/v1
98 apiKey: <YOUR_OPEN_ROUTER_API_KEY>
99 capabilities:
100 - tool_use # Enable function calling for Agent mode
101 - image_input # Enable image upload support
102 ```
103 </Tab>
104 <Tab title="JSON">
105 ```json title="config.json"
106 {
107 "models": [
108 {
109 "title": "Claude via OpenRouter",
110 "provider": "openrouter",
111 "model": "anthropic/claude-3.5-sonnet",
112 "apiBase": "https://openrouter.ai/api/v1",
113 "apiKey": "<YOUR_OPEN_ROUTER_API_KEY>",
114 "capabilities": {
115 "tools": true,
116 "uploadImage": true
117 }
118 }
119 ]
120 }
121 ```
122 </Tab>
123</Tabs>
124
125Note: Not all models support function calling. Check the [OpenRouter models page](https://openrouter.ai/models) for specific model capabilities.