# Command Code

Source: https://docs.aicentos.com/en/clients/command-code

Language: en

> Use aicentos in Command Code — add a BYOK provider through providers.json

Command Code is a terminal coding agent that uses its built-in providers by default and also supports BYOK: register a custom provider in `~/.commandcode/providers.json` and point the baseURL at aicentos.

## Prerequisites

First create a dedicated key for Command Code on the console's "API Keys" page (naming it `command-code` makes usage easier to track):

* Console: [https://aicentos.com](https://aicentos.com)
* Create a key: [https://aicentos.com/keys](https://aicentos.com/keys)
* Top up when the balance runs out: [https://aicentos.com/wallet](https://aicentos.com/wallet)

## Configuration to fill in

| Field       | Value                                              |
| ----------- | -------------------------------------------------- |
| Config file | `~/.commandcode/providers.json`                    |
| baseURL     | `https://aicentos.com/v1`                          |
| apiKey      | `$AICENTOS_API_KEY`                                |
| Model       | A model name from the Model Gallery in the console |

## Setup steps

### 1. Set the environment variable

```bash
export AICENTOS_API_KEY="sk-your-API-Key"
```

Add it to `~/.zshrc` or `~/.bashrc` to persist it.

### 2. Edit providers.json

Edit `~/.commandcode/providers.json` and add an entry under the `provider` object:

```json
{
  "provider": {
    "aicentos": {
      "name": "aicentos",
      "api": "openai-completions",
      "baseURL": "https://aicentos.com/v1",
      "apiKey": "$AICENTOS_API_KEY",
      "models": {
        "gpt-4o": {}
      }
    }
  }
}
```

Field descriptions:

| Field     | Description                                                                               |
| --------- | ----------------------------------------------------------------------------------------- |
| `name`    | Display name, shown in `/connect` and `/model`                                            |
| `api`     | `openai-completions` (default) or `anthropic-messages`                                    |
| `baseURL` | Required. API root address, must include `/v1`                                            |
| `apiKey`  | Supports `$VAR`, `{env:VAR}`, `!command`, or set to `false` for unauthenticated endpoints |
| `models`  | Required; `{}` is enough, model IDs must match the endpoint                               |

Replace the model IDs in `models` with names from the Model Gallery in the console; see [Supported models](https://docs.aicentos.com/en/billing/models-list).

### 3. Select the provider

Once inside Command Code:

* Run `/connect`, select `aicentos` and complete the key confirmation;
* Run `/model` and choose the model to use.

Note: **after modifying `providers.json`, you need to reopen `/model`** for the new configuration to load.

## Test

After picking the model, send a simple prompt:

```
Answer in one sentence: what is 1+1?
```

A normal response means the integration works. You can also press `u` on the provider in `/connect` to have it call the endpoint's `/models` and refresh the model list.

## Notes

* Command Code uses OpenAI-compatible Chat Completions by default, so setting `api` to `openai-completions` is enough.
* To use Claude-family models, you need a separate provider entry with `api: "anthropic-messages"` — the two protocols build paths differently (the OpenAI SDK appends `/chat/completions`, the Anthropic SDK appends `/v1/messages`), so a single baseURL cannot serve both.
* `baseURL` must include `/v1`; Command Code appends the remaining path itself.
* Pasting a plain-text key directly into `apiKey` is rejected; use the `$VAR` form.
* Troubleshooting order: can you see the model in `/model` → are the environment variables visible in the terminal you launched from → does baseURL stop at `/v1` → is the balance sufficient.

## Related links

* Official BYOK documentation: [https://commandcode.ai/docs/byok](https://commandcode.ai/docs/byok)