| 1 | --- |
| 2 | title: "How to Configure OpenAI Models with Continue" |
| 3 | slug: ../openai |
| 4 | sidebarTitle: "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 | |
| 49 | OpenAI 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 | - [Tetrate Agent Router Service](https://router.tetrate.ai) |
| 60 | |
| 61 | If you are using an OpenAI API compatible providers, you can change the `apiBase` like this: |
| 62 | |
| 63 | <Tabs> |
| 64 | <Tab title="YAML"> |
| 65 | ```yaml title="config.yaml" |
| 66 | models: |
| 67 | - name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL> |
| 68 | provider: openai |
| 69 | model: <MODEL_NAME> |
| 70 | apiBase: http://localhost:8000/v1 |
| 71 | apiKey: <YOUR_CUSTOM_API_KEY> |
| 72 | ``` |
| 73 | </Tab> |
| 74 | <Tab title="JSON (Deprecated)"> |
| 75 | ```json title="config.json" |
| 76 | { |
| 77 | "models": [ |
| 78 | { |
| 79 | "title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>", |
| 80 | "provider": "openai", |
| 81 | "model": "<MODEL_NAME>", |
| 82 | "apiKey": "<YOUR_CUSTOM_API_KEY>", |
| 83 | "apiBase": "http://localhost:8000/v1" |
| 84 | } |
| 85 | ] |
| 86 | } |
| 87 | ``` |
| 88 | </Tab> |
| 89 | </Tabs> |
| 90 | |
| 91 | ### How to Force Legacy Completions Endpoint Usage |
| 92 | |
| 93 | To force usage of `chat/completions` instead of `completions` endpoint you can set: |
| 94 | |
| 95 | <Tabs> |
| 96 | <Tab title="YAML"> |
| 97 | ```yaml title="config.yaml" |
| 98 | models: |
| 99 | - name: <OPENAI_API_COMPATIBLE_PROVIDER_MODEL> |
| 100 | provider: openai |
| 101 | model: <MODEL_NAME>> |
| 102 | apiBase: http://localhost:8000/v1 |
| 103 | useLegacyCompletionsEndpoint: true |
| 104 | ``` |
| 105 | </Tab> |
| 106 | <Tab title="JSON (Deprecated)"> |
| 107 | ```json title="config.json" |
| 108 | { |
| 109 | "models": [ |
| 110 | { |
| 111 | "title": "<OPENAI_API_COMPATIBLE_PROVIDER_MODEL>", |
| 112 | "provider": "openai", |
| 113 | "model": "<MODEL_NAME>", |
| 114 | "apiBase": "http://localhost:8000/v1", |
| 115 | "useLegacyCompletionsEndpoint": true |
| 116 | } |
| 117 | ] |
| 118 | } |
| 119 | ``` |
| 120 | </Tab> |
| 121 | </Tabs> |