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