|
| 1 | +--- |
| 2 | +title: Use CodeGate with Open Interpreter |
| 3 | +description: Configure Open Interpreter to use CodeGate |
| 4 | +sidebar_label: Open Interpreter |
| 5 | +sidebar_position: 70 |
| 6 | +--- |
| 7 | + |
| 8 | +import Tabs from '@theme/Tabs'; |
| 9 | +import TabItem from '@theme/TabItem'; |
| 10 | + |
| 11 | +[Open Interpreter](https://github.com/openinterpreter/open-interpreter) lets |
| 12 | +LLMs run code locally through a ChatGPT-like interface in your terminal. |
| 13 | + |
| 14 | +CodeGate works with [OpenAI](https://openai.com/api/) and OpenAI-compatible APIs |
| 15 | +through Open Interpreter. |
| 16 | + |
| 17 | +:::note |
| 18 | + |
| 19 | +This guide assumes you have already installed Open Interpreter using their |
| 20 | +[installation instructions](https://docs.openinterpreter.com/getting-started/setup). |
| 21 | + |
| 22 | +::: |
| 23 | + |
| 24 | +## Configure Open Interpreter to use CodeGate |
| 25 | + |
| 26 | +To configure Open Interpreter to send requests through CodeGate, run |
| 27 | +`interpreter` with the |
| 28 | +[API base setting](https://docs.openinterpreter.com/settings/all-settings#api-base) |
| 29 | +set to CodeGate's local API port, `http://localhost:8989/openai`. |
| 30 | + |
| 31 | +By default, CodeGate connects to the [OpenAI API](https://openai.com/api/). To |
| 32 | +use a different OpenAI-compatible endpoint, set the `CODEGATE_OPENAI_URL` |
| 33 | +[configuration parameter](../how-to/configure.md#config-parameters) when you run |
| 34 | +CodeGate. |
| 35 | + |
| 36 | +<Tabs> |
| 37 | + <TabItem value="current" label="Open Interpreter v0.4.x" default> |
| 38 | + ```bash |
| 39 | + interpreter --api_base http://localhost:8989/openai --api_key YOUR_API_KEY --model MODEL_NAME |
| 40 | + ``` |
| 41 | + |
| 42 | + </TabItem> |
| 43 | + <TabItem value="dev" label="v1.0 dev branch"> |
| 44 | + If you are running Open Interpreter's v1.0 |
| 45 | + [development branch](https://github.com/OpenInterpreter/open-interpreter/tree/development): |
| 46 | + |
| 47 | + ```bash |
| 48 | + interpreter --api-base http://localhost:8989/openai --api-key YOUR_API_KEY --model MODEL_NAME |
| 49 | + ``` |
| 50 | + |
| 51 | + </TabItem> |
| 52 | +</Tabs> |
| 53 | + |
| 54 | +Replace `YOUR_API_KEY` with your OpenAI API key, and `MODEL_NAME` with your |
| 55 | +desired model, like `openai/gpt-4o-mini`. |
| 56 | + |
| 57 | +:::info |
| 58 | + |
| 59 | +The `--model` parameter value must start with `openai/` for CodeGate to properly |
| 60 | +handle the request. |
| 61 | + |
| 62 | +::: |
| 63 | + |
| 64 | +## Verify configuration |
| 65 | + |
| 66 | +To verify that you've successfully connected Open Interpreter to CodeGate, type |
| 67 | +`codegate version` into the Open Interpreter chat. You should receive a response |
| 68 | +like "CodeGate version 0.1.16". |
| 69 | + |
| 70 | +## Next steps |
| 71 | + |
| 72 | +Learn more about [CodeGate's features](../features/index.mdx) and explore the |
| 73 | +[dashboard](../how-to/dashboard.md). |
| 74 | + |
| 75 | +## Remove CodeGate |
| 76 | + |
| 77 | +If you decide to stop using CodeGate, follow these steps to remove it and revert |
| 78 | +your environment. |
| 79 | + |
| 80 | +1. Quit Open Interpreter (<key>Ctrl</key>+<key>C</key>) and re-run it without |
| 81 | + the API base parameter. |
| 82 | + |
| 83 | +1. Stop and remove the CodeGate container: |
| 84 | + |
| 85 | + ```bash |
| 86 | + docker stop codegate && docker rm codegate |
| 87 | + ``` |
| 88 | + |
| 89 | +1. If you launched CodeGate with a persistent volume, delete it to remove the |
| 90 | + CodeGate database and other files: |
| 91 | + |
| 92 | + ```bash |
| 93 | + docker volume rm codegate_volume |
| 94 | + ``` |
0 commit comments