# CodeBuddy

Source: https://docs.aicentos.com/en/clients/codebuddy

Language: en

> Connect to aicentos' OpenAI-compatible endpoint in CodeBuddy (IDE / CLI) through models.json

CodeBuddy supports custom models: through a user-level or project-level `models.json` you can point requests at aicentos' OpenAI-compatible endpoint. The IDE and the CodeBuddy Code CLI share the same configuration.

## Prerequisites

First create a dedicated key for CodeBuddy on the console's "API Keys" page (naming it `codebuddy` is recommended).

* Console: [https://aicentos.com](https://aicentos.com)
* Create a key: [https://aicentos.com/keys](https://aicentos.com/keys)
* Wallet top-up: [https://aicentos.com/wallet](https://aicentos.com/wallet)

## Configuration to fill in

| Field                                | Value                                              |
| ------------------------------------ | -------------------------------------------------- |
| Base URL                             | `https://aicentos.com/v1`                          |
| Endpoint URL (`url` field)           | `https://aicentos.com/v1/chat/completions`         |
| API Key (`apiKey`)                   | The key created in the console                     |
| Model ID (`id`)                      | A model name from the Model Gallery in the console |
| `supportsToolCall`                   | `true`                                             |
| `maxInputTokens` / `maxOutputTokens` | Set according to the chosen model                  |

Note: the `url` field in `models.json` requires the **full endpoint path** and must end with `/chat/completions`.

## Setup steps

* Open CodeBuddy once so it generates the configuration directory.
* Create or edit the user-level configuration file:
  * macOS / Linux: `~/.codebuddy/models.json`
  * Windows: `C:\Users\<username>\.codebuddy\models.json`
  * If it should only apply to a single project, use the project-level `<project root>/.codebuddy/models.json` instead, which takes precedence over the user-level file.
* Write the following, replacing `id` with a model name you have confirmed works in the console:

```json
{
  "models": [
    {
      "id": "gpt-5",
      "name": "GPT-5 (aicentos)",
      "vendor": "aicentos",
      "apiKey": "${AICENTOS_API_KEY}",
      "url": "https://aicentos.com/v1/chat/completions",
      "maxInputTokens": 128000,
      "maxOutputTokens": 16384,
      "supportsToolCall": true,
      "supportsImages": false,
      "supportsReasoning": false
    }
  ]
}
```

* Set the environment variable (both `apiKey` and `url` support `${VAR_NAME}` references):

```bash
export AICENTOS_API_KEY="sk-your-aicentos-key"
```

* Quit CodeBuddy completely and reopen it (restarting the IDE panel is enough).
* Select the newly configured model in the model picker.

If you would rather not edit files, click the model picker below the chat panel in the CodeBuddy IDE → **Configure custom model** → choose **Custom** as the provider, then fill in the Base URL `https://aicentos.com/v1`, the API Key and the model name.

## Test

After saving, start a new conversation or coding task and run a lightweight test with a simple prompt first; only start real use once responses come back normally.

## Notes

* Only APIs in **OpenAI interface format** are currently supported.
* `url` must be written as the full `/v1/chat/completions` path; `https://aicentos.com/v1` will not work.
* The outermost structure must be `{"models": [...]}`; `models` is a required top-level field.
* `availableModels` is a whitelist: once set, the model dropdown only shows the listed models and built-in models disappear as well. Omit the field if you do not need the restriction.
* Save the file as **UTF-8 without BOM**; JSON with a BOM breaks reading of the local model configuration.
* Environment variables are resolved at startup; if a variable does not exist, `${AICENTOS_API_KEY}` in the configuration file is kept literally and calls fail.
* Set `models.json` permissions to `600` and do not commit it to version control.
* The CLI can also be configured with environment variables: `CODEBUDDY_API_KEY`, `CODEBUDDY_BASE_URL`, `CODEBUDDY_MODEL`. When setting `CODEBUDDY_BASE_URL` directly, do not include `/chat/completions` — the CLI appends it itself.
* See the docs site for more details: [https://docs.aicentos.com](https://docs.aicentos.com)