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

# Claude Code

> Connect Claude Code to derestricted.ai through the Anthropic-compatible Messages API.

Use Claude Code from your terminal with `derestricted-llm` handling model requests.

## Before you start

[Install Claude Code](https://code.claude.com/docs/en/setup), then create an API key in the [console](https://derestricted.ai/console/). New verified accounts receive \$5 in starting credit.

## Configure the connection

In the terminal where you will run Claude Code, replace the placeholder with your key:

```bash theme={"system"}
export DERESTRICTED_API_KEY="glmk_YOUR_API_KEY"
export ANTHROPIC_BASE_URL="https://api.derestricted.ai"
export ANTHROPIC_AUTH_TOKEN="$DERESTRICTED_API_KEY"
export ANTHROPIC_MODEL="derestricted-llm"
```

Use the base URL exactly as shown, without `/v1`. Claude Code appends the Messages API path. `ANTHROPIC_AUTH_TOKEN` sends the key as a bearer token. See Claude Code's [gateway configuration](https://code.claude.com/docs/en/llm-gateway-connect).

To use the same model when Claude Code selects a model family for a helper task, also set:

```bash theme={"system"}
export ANTHROPIC_DEFAULT_OPUS_MODEL="derestricted-llm"
export ANTHROPIC_DEFAULT_SONNET_MODEL="derestricted-llm"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="derestricted-llm"
```

These names select the derestricted model through Claude Code's [model configuration](https://code.claude.com/docs/en/model-config); they do not provide access to Anthropic's Claude models.

## Start a session

From your project directory:

```bash theme={"system"}
claude --model derestricted-llm
```

For a single terminal request:

```bash theme={"system"}
claude --model derestricted-llm -p "Summarize README.md in three bullets."
```

Run `/status` to check the base URL and credential source. Shell exports apply to programs launched from that terminal. For persistent settings, follow the [user settings instructions](https://code.claude.com/docs/en/llm-gateway-connect#set-in-a-settings-file); keep credentials out of shared project files.

## If something fails

* **Authentication:** check `/status` for an old key or conflicting credential setting. Use a key from the derestricted console.
* **Long sessions:** run `/compact` or start a smaller task after a `413`. Request limits depend on serialized content, not just the token count shown by Claude Code.
* **Unsupported features:** this endpoint supports text and client-executed tools. Image input and Anthropic-specific thinking controls are not supported. See [Anthropic compatibility](/api/anthropic-compatibility).
* **Credits or rate limits:** check your [console balance](https://derestricted.ai/console/) and the [error guide](/api/errors).
