Elffuss BraidHub

kikocis/continue public

19cfb6ec829a · 4.1 KiBRawPermalink
1---
2title: "How to Configure OpenAI Models with Continue"
3slug: ../openai
4description: "Configure OpenAI models with Continue, including GPT-4o for chat and text-embedding-3-large for embeddings, with support for OpenAI-compatible servers and APIs"
5sidebarTitle: "OpenAI"
6---
7
8<Info>
9 You can get an API key from the [OpenAI
10 console](https://platform.openai.com/account/api-keys)
11</Info>
12
13## How to Set Up OpenAI Chat Models
14
15We recommend configuring **GPT-4o** as your chat model.
16
17<Tabs>
18 <Tab title="YAML">
19 ```yaml title="config.yaml"
20 models:
21 - name: GPT-4o
22 provider: openai
23 model: gpt-4o
24 apiKey: <YOUR_OPENAI_API_KEY>
25 ```
26 </Tab>
27 <Tab title="JSON">
28 ```json title="config.json"
29 {
30 "models": [
31 {
32 "title": "GPT-4o",
33 "provider": "openai",
34 "model": "gpt-4o",
35 "apiKey": "<YOUR_OPENAI_API_KEY>"
36 }
37 ]
38 }
39 ```
40 </Tab>
41</Tabs>
42
43## OpenAI Autocomplete Model Availability
44
45OpenAI currently does not offer any autocomplete models.
46
47[Click here](../../model-roles/autocomplete) to see a list of autocomplete model providers.
48
49## How to Configure OpenAI Embeddings Models
50
51We recommend configuring **text-embedding-3-large** as your embeddings model.
52
53<Tabs>
54 <Tab title="YAML">
55 ```yaml title="config.yaml"
56 models:
57 - name: OpenAI Embeddings
58 provider: openai
59 model: text-embedding-3-large
60 apiKey: <YOUR_OPENAI_API_KEY>
61 roles:
62 - embed
63 ```
64 </Tab>
65 <Tab title="JSON">
66 ```json title="config.json"
67 {
68 "embeddingsProvider": {
69 "provider": "openai",
70 "model": "text-embedding-3-large",
71 "apiKey": "<YOUR_OPENAI_API_KEY>"
72 }
73 }
74 ```
75 </Tab>
76</Tabs>
77
78## OpenAI Reranking Model Availability
79
80OpenAI currently does not offer any reranking models.
81
82[Click here](../../model-roles/reranking.mdx) to see a list of reranking model providers.
83
84## How to Use OpenAI-Compatible Servers and APIs
85
86OpenAI compatible servers
87
88- [KoboldCpp](https://github.com/lostruins/koboldcpp)
89- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
90- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
91- [LocalAI](https://localai.io/basics/getting_started/)
92- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
93- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples)
94- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)
95- [BerriAI/litellm](https://github.com/BerriAI/litellm)
96
97OpenAI compatible APIs
98
99- [Anyscale Endpoints](https://github.com/continuedev/deploy-os-code-llm#others)
100- [Anyscale Private Endpoints](https://github.com/continuedev/deploy-os-code-llm#anyscale-private-endpoints)
101
102### How to Configure Custom API Base for OpenAI-Compatible Services
103
104If you are using an OpenAI compatible server / API, you can change the `apiBase` like this:
105
106<Tabs>
107 <Tab title="YAML">
108 ```yaml title="config.yaml"
109 models:
110 - name: OpenAI-compatible server / API
111 provider: openai
112 model: MODEL_NAME
113 apiBase: http://localhost:8000/v1
114 apiKey: <YOUR_CUSTOM_API_KEY>
115 ```
116 </Tab>
117 <Tab title="JSON">
118 ```json title="config.json"
119 {
120 "models": [
121 {
122 "title": "OpenAI-compatible server / API",
123 "provider": "openai",
124 "model": "MODEL_NAME",
125 "apiKey": "<YOUR_CUSTOM_API_KEY>",
126 "apiBase": "http://localhost:8000/v1"
127 }
128 ]
129 }
130 ```
131 </Tab>
132</Tabs>
133
134### How to Force Legacy Completions Endpoint Usage
135
136To force usage of `chat/completions` instead of `completions` endpoint you can set:
137
138<Tabs>
139 <Tab title="YAML">
140 ```yaml title="config.yaml"
141 models:
142 - name: OpenAI-compatible server / API
143 provider: openai
144 model: MODEL_NAME
145 apiBase: http://localhost:8000/v1
146 useLegacyCompletionsEndpoint: true
147 ```
148 </Tab>
149 <Tab title="JSON">
150 ```json title="config.json"
151 {
152 "models": [
153 {
154 "title": "OpenAI-compatible server / API",
155 "provider": "openai",
156 "model": "MODEL_NAME",
157 "apiBase": "http://localhost:8000/v1",
158 "useLegacyCompletionsEndpoint": true
159 }
160 ]
161 }
162 ```
163 </Tab>
164</Tabs>