Elffuss BraidHub

kikocis/continue public

main · 2.7 KiBRawPermalink
1---
2title: "How to Self-Host a Model"
3description: "Learn how to deploy and self-host open-source language models using HuggingFace TGI, vLLM, SkyPilot, Anyscale Private Endpoints, or Lambda for use with Continue"
4---
5
6- [HuggingFace TGI](https://github.com/continuedev/deploy-os-code-llm#tgi)
7- [vLLM](https://github.com/continuedev/deploy-os-code-llm#vllm)
8- [SkyPilot](https://github.com/continuedev/deploy-os-code-llm#skypilot)
9- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints) (OpenAI compatible API)
10- [Lambda](https://github.com/continuedev/deploy-os-code-llm#lambda)
11
12## How to Self-Host an Open-Source Model
13
14For many cases, either Continue will have a built-in provider or the API you use will be OpenAI-compatible, in which case you can use the "openai" provider and change the "baseUrl" to point to the server.
15
16However, if neither of these are the case, you will need to wire up a new LLM object.
17
18## How to Set Up Authentication
19
20Basic authentication can be done with any provider using the `apiKey` field:
21
22- YAML
23- JSON
24
25config.yaml
26
27```
28models:
29 - name: Ollama
30 provider: ollama
31 model: llama2-7b
32 apiKey: <YOUR_CUSTOM_OLLAMA_SERVER_API_KEY>
33```
34
35config.json
36
37```json
38{
39 "models": [
40 {
41 "title": "Ollama",
42 "provider": "ollama",
43 "model": "llama2-7b",
44 "apiKey": "<YOUR_CUSTOM_OLLAMA_SERVER_API_KEY>"
45 }
46 ]
47}
48```
49
50This translates to the header `"Authorization": "Bearer xxx"`.
51
52If you need to send custom headers for authentication, you may use the `requestOptions.headers` property like in this example with Ollama:
53
54- YAML
55- JSON
56
57config.yaml
58
59```
60models:
61 - name: Ollama
62 provider: ollama
63 model: llama2-7b
64 requestOptions:
65 headers:
66 X-Auth-Token: xxx
67```
68
69config.json
70
71```json
72{
73 "models": [
74 {
75 "title": "Ollama",
76 "provider": "ollama",
77 "model": "llama2-7b",
78 "requestOptions": { "headers": { "X-Auth-Token": "xxx" } }
79 }
80 ]
81}
82```
83
84Similarly if your model requires a Certificate for authentication, you may use the `requestOptions.clientCertificate` property like in the example below:
85
86- YAML
87- JSON
88
89config.yaml
90
91```
92models:
93 - name: Ollama
94 provider: ollama
95 model: llama2-7b
96 requestOptions:
97 clientCertificate:
98 cert: C:\tempollama.pem
99 key: C:\tempollama.key
100 passphrase: c0nt!nu3
101```
102
103config.json
104
105```json
106{
107 "models": [
108 {
109 "title": "Ollama",
110 "provider": "ollama",
111 "model": "llama2-7b",
112 "requestOptions": {
113 "clientCertificate": {
114 "cert": "C:\\tempollama.pem",
115 "key": "C:\\tempollama.key",
116 "passphrase": "c0nt!nu3"
117 }
118 }
119 }
120 ]
121}
122```