> ## 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.

# Claude Code

> Connect Claude Code through a local Messages adapter.

Use a local Messages-to-Chat-Completions adapter to route Claude Code requests to a NoMask text model.

> [!NOTE]
>
> Advanced compatibility setup. Claude Code expects Anthropic Messages, which NoMask does not expose directly. Anthropic does not support routing Claude Code to non-Claude models; features and tool behavior can differ through an adapter.

## 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. Start a local protocol adapter

Install Python 3.11 or newer. In a dedicated terminal, install the current LiteLLM proxy package:

```bash theme={"system"}
python -m pip install --upgrade "litellm[proxy]>=1.101.6"
```

Codex needs the tool-call fixes in LiteLLM 1.101.6 or newer. Keep the adapter updated when updating your coding tool.

Set your NoMask key and a separate local adapter password. Replace both placeholders and keep this terminal open.

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

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

Save this as `nomask-adapter.yaml`. The local alias `nomask` routes to `your-model-id`; changing models means updating this route and restarting the adapter.

```yaml theme={"system"}
model_list:
  - model_name: nomask
    litellm_params:
      model: "custom_openai/your-model-id"
      api_base: "https://api.nomask.ai/v1"
      api_key: os.environ/NOMASK_API_KEY
litellm_settings:
  drop_params: true
  set_verbose: false
general_settings:
  master_key: os.environ/NOMASK_GATEWAY_KEY
```

`custom_openai/` makes LiteLLM translate requests into Chat Completions. Do not enable native Responses or Messages passthrough: NoMask does not expose those protocols. Unsupported optional fields may be removed by `drop_params`.

```bash theme={"system"}
litellm --config nomask-adapter.yaml --host 127.0.0.1 --port 4000
```

This example binds to your own computer. The adapter handles prompt traffic, so its logging and storage settings are under your control. Keep debug logging and `store_prompts_in_spend_logs` off. NoMask's prompt-storage policy is unchanged.

### 2. Install Claude Code

Open a second terminal and use the installer for your operating system:

> [tab] macOS / Linux / WSL
>
> ```bash theme={"system"}
> curl -fsSL https://claude.ai/install.sh | bash
> claude --version
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={"system"}
> irm https://claude.ai/install.ps1 | iex
> claude --version
> ```

### 3. Set the connection and model aliases

Merge this into your personal `~/.claude/settings.json` file (`%USERPROFILE%\.claude\settings.json` on Windows). Every alias below routes to the same NoMask model configured in the adapter.

```json theme={"system"}
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:4000",
    "ANTHROPIC_MODEL": "nomask",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "nomask",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "nomask",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "nomask",
    "CLAUDE_CODE_SUBAGENT_MODEL": "nomask"
  }
}
```

Keep the adapter password in the launch terminal. Replace the placeholder with the same local secret used in `NOMASK_GATEWAY_KEY`. Clear a conflicting Anthropic key in this terminal:

> [tab] macOS / Linux / WSL
>
> ```bash theme={"system"}
> export ANTHROPIC_AUTH_TOKEN="sk-REPLACE_WITH_LOCAL_SECRET"
> unset ANTHROPIC_API_KEY
> ```

> [tab] Windows PowerShell
>
> ```powershell theme={"system"}
> $env:ANTHROPIC_AUTH_TOKEN = "sk-REPLACE_WITH_LOCAL_SECRET"
> Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue
> ```

Use the adapter origin without `/v1` here: Claude Code appends `/v1/messages`. Changes to your shell variables require restarting Claude Code.

## Launch and test

```bash theme={"system"}
cd path/to/a-test-project
claude --model nomask
```

Run `/status` to check the connection, then ask for `NOMASK_OK`. Next ask it to read the project files and create `nomask-test.txt`. Review its file actions and check the follow-up response.

Confirm requests appear in [API Overview](https://nomask.ai/api/overview) under the actual NoMask model. The `nomask` name is only a local routing alias.

> [!NOTE]
>
> If an alias fails, make sure all configured aliases still say `nomask` and that the adapter is running. Extended thinking, prompt-cache controls and other Claude-specific features are not guaranteed by protocol translation. Use a direct integration if the tool loop fails.

## 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.

* [Claude Code installation](https://code.claude.com/docs/en/quickstart)
* [Claude Code gateway support and limitations](https://code.claude.com/docs/en/llm-gateway)
* [Claude Code model aliases and environment settings](https://code.claude.com/docs/en/model-config)
* [LiteLLM Claude Code configuration](https://docs.litellm.ai/docs/proxy/client_setup/claude_code)
* [LiteLLM adapter route configuration](https://docs.litellm.ai/docs/proxy/configs)


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