Elffuss BraidHub

kikocis/continue public

9875eaa07e45 · 3.0 KiBRawPermalink
1---
2title: "How to Configure OpenAI Models with Continue"
3slug: ../openai
4sidebarTitle: "OpenAI"
5---
6
7<Tip>
8 **Discover OpenAI models [here](https://hub.continue.dev/openai)**
9</Tip>
10
11<Info>
12 Get an API key from the [OpenAI Console](https://platform.openai.com/account/api-keys)
13</Info>
14
15## Configuration
16
17<Tabs>
18 <Tab title="YAML">
19 ```yaml title="config.yaml"
20 models:
21 - name: <MODEL_NAME>
22 provider: openai
23 model: <MODEL_ID>
24 apiKey: <YOUR_OPENAI_API_KEY>
25 ```
26 </Tab>
27 <Tab title="JSON (Deprecated)">
28 ```json title="config.json"
29 {
30 "models": [
31 {
32 "title": "<MODEL_NAME>",
33 "provider": "openai",
34 "model": "<MODEL_ID>",
35 "apiKey": "<YOUR_OPENAI_API_KEY>"
36 }
37 ]
38 }
39 ```
40 </Tab>
41</Tabs>
42
43<Info>
44 **Check out a more advanced configuration [here](https://hub.continue.dev/openai/gpt-5?view=config)**
45</Info>
46
47## OpenAI API compatible providers
48
49OpenAI API compatible providers include
50
51- [KoboldCpp](https://github.com/lostruins/koboldcpp)
52- [text-gen-webui](https://github.com/oobabooga/text-generation-webui/tree/main/extensions/openai#setup--installation)
53- [FastChat](https://github.com/lm-sys/FastChat/blob/main/docs/openai_api.md)
54- [LocalAI](https://localai.io/basics/getting_started/)
55- [llama-cpp-python](https://github.com/abetlen/llama-cpp-python#web-server)
56- [TensorRT-LLM](https://github.com/NVIDIA/trt-llm-as-openai-windows?tab=readme-ov-file#examples)
57- [vLLM](https://docs.vllm.ai/en/latest/serving/openai_compatible_server.html)
58- [BerriAI/litellm](https://github.com/BerriAI/litellm)
59
60If you are using an OpenAI API compatible providers, you can change the `apiBase` like this:
61
62<Tabs>
63 <Tab title="YAML">
64 ```yaml title="config.yaml"
65 models:
66 - name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL>
67 provider: openai
68 model: <MODEL_NAME>
69 apiBase: http://localhost:8000/v1
70 apiKey: <YOUR_CUSTOM_API_KEY>
71 ```
72 </Tab>
73 <Tab title="JSON (Deprecated)">
74 ```json title="config.json"
75 {
76 "models": [
77 {
78 "title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
79 "provider": "openai",
80 "model": "<MODEL_NAME>",
81 "apiKey": "<YOUR_CUSTOM_API_KEY>",
82 "apiBase": "http://localhost:8000/v1"
83 }
84 ]
85 }
86 ```
87 </Tab>
88</Tabs>
89
90### How to Force Legacy Completions Endpoint Usage
91
92To force usage of `chat/completions` instead of `completions` endpoint you can set:
93
94<Tabs>
95 <Tab title="YAML">
96 ```yaml title="config.yaml"
97 models:
98 - name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL>
99 provider: openai
100 model: <MODEL_NAME>>
101 apiBase: http://localhost:8000/v1
102 useLegacyCompletionsEndpoint: true
103 ```
104 </Tab>
105 <Tab title="JSON (Deprecated)">
106 ```json title="config.json"
107 {
108 "models": [
109 {
110 "title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>",
111 "provider": "openai",
112 "model": "<MODEL_NAME>",
113 "apiBase": "http://localhost:8000/v1",
114 "useLegacyCompletionsEndpoint": true
115 }
116 ]
117 }
118 ```
119 </Tab>
120</Tabs>