> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nomask.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Command Code

> Use Command Code with a NoMask API key and Chat Completions.

Use NoMask in the Command Code terminal app with its bring-your-own-key setup.

## Before you start

* Create a key on the [API Keys page](https://nomask.ai/api/keys) and add funds to your API balance.
* Choose a text model with **Function calling** and streaming on the [Models page](https://nomask.ai/models). Copy its exact model ID.
* Use the connection values below. Replace key placeholders locally; keep secrets out of project files and source control.

| Setting | Value |
| - | - |
| **API base URL** | `https://api.nomask.ai/v1` |
| **Model ID** | `your-model-id` |
| **API key** | Your NoMask API key |

> [!NOTE]
>
> Replace `your-model-id` throughout the examples with the exact ID of a text model that supports function calling and streaming. Check the [Models page](https://nomask.ai/models) for current availability and limits.

Examples use your selected model. If you change it, also update context, output and image settings to match that model. These guides cover text models; Image Studio models use separate image endpoints.

## Install and configure

### 1. Install Command Code

Install Node.js 22 or newer, then run:

```bash theme={"system"}
npm install -g command-code@latest
command-code --version
```

The full `command-code` command works on Windows, macOS and Linux. Its Windows shortcut is `cmdc`; `cmd` on Windows opens the system shell.

### 2. Set your API key

Run this in the terminal you will use to launch the app. Replace the placeholder with your key.

> [tab] macOS / Linux / WSL
>
> ```bash theme={"system"}
> export NOMASK_API_KEY="YOUR_NOMASK_API_KEY"
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={"system"}
> $env:NOMASK_API_KEY = "YOUR_NOMASK_API_KEY"
> ```

### 3. Add the connection

Create `~/.commandcode/providers.json` in your home directory. On Windows, use `%USERPROFILE%\.commandcode\providers.json`. Merge this entry if the file already exists.

```json theme={"system"}
{
  "provider": {
    "nomask": {
      "name": "NoMask",
      "api": "openai-completions",
      "baseURL": "https://api.nomask.ai/v1",
      "apiKey": "$NOMASK_API_KEY",
      "models": {
        "your-model-id": {
          "name": "Your NoMask model"
        }
      }
    }
  }
}
```

`openai-completions` selects Chat Completions. Keep the base URL as shown; do not append `/chat/completions`.

> [!NOTE]
>
> BYOK support is currently in beta. The key stays in the environment; `apiKey` must contain the variable reference, not a pasted key.

## Launch and test

Open your project and launch with `--local-only` to use the configured connection without a Command Code account.

```bash theme={"system"}
cd path/to/your-project
command-code --local-only
```

* Enter `/model` and select `your-model-id` under **NoMask**.
* Ask: `Reply with exactly NOMASK_OK. Do not edit files.`
* Then ask it to create `nomask-test.txt` containing `NOMASK_OK`. Review the proposed file action to check that tool calls work.

Local-only mode keeps local editing tools available. Command Code account features, including its built-in search and fetch, are unavailable in that mode.

> [!NOTE]
>
> If the model is missing, reopen `/model` after saving the JSON. Check for a configuration warning and confirm `NOMASK_API_KEY` is set in the same terminal.

## Troubleshooting

* **401:** check that your key is active and available to the process running the tool. Restart the tool after changing environment variables.
* **402:** add funds to your API balance or reduce the requested output.
* **404:** check the exact model ID and base URL. Direct connections use Chat Completions, not Responses or Anthropic Messages.
* **429:** wait for `Retry-After`. API keys share account limits; creating another key does not reset usage. Check the key's monthly spending cap too.
* **Context or tool errors:** start a shorter task, lower the output limit and confirm the model supports function calling. A plain text reply alone does not confirm file-editing tools work.

Check [API Overview](https://nomask.ai/api/overview) for usage and recent errors. Include the request ID when contacting support; never send your key. See [Errors](https://docs.nomask.ai/errors.md) and [Rate Limits](https://docs.nomask.ai/rate-limits.md).

## Official references

Setup checked against the documentation below. Tool versions may change their settings or configuration format.

* [Command Code installation and Windows commands](https://commandcode.ai/docs/quickstart)
* [Command Code BYOK configuration and local-only mode](https://commandcode.ai/docs/byok)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.