> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/documentation/claude-code-cli.md).

# Claude Code CLI

The recommended way to use Tensorix models with Claude Code.

## Recommended Models

We recommend these models for Claude Code:

| Model                    | Model ID               | Best For                                                                                            |
| ------------------------ | ---------------------- | --------------------------------------------------------------------------------------------------- |
| **GLM-4.7**              | `z-ai/glm-4.7`         | Tool calling & functions ([official docs](https://docs.z.ai/scenario-example/develop-tools/claude)) |
| **MiniMax-M2** (Default) | `minimax/minimax-m2`   | General coding, reasoning                                                                           |
| **MiniMax-M2.1**         | `minimax/minimax-m2.1` | Latest capabilities                                                                                 |

## Install Claude Code

Refer to the [Claude Code documentation](https://docs.anthropic.com/claude-code) for installation.

## Configure Tensorix API

{% hint style="warning" %}
**Important:** Clear existing Anthropic environment variables before configuration to avoid conflicts:

* `ANTHROPIC_AUTH_TOKEN`
* `ANTHROPIC_BASE_URL`
  {% endhint %}

1. Edit or create the Claude Code configuration file at `~/.claude/settings.json`:

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tensorix.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_TENSORIX_API_KEY>",
    "ANTHROPIC_MODEL": "minimax/minimax-m2",
    "ANTHROPIC_SMALL_FAST_MODEL": "minimax/minimax-m2",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```

2. Navigate to your working directory and run `claude` in the terminal.
3. Select **Trust This Folder** when prompted.
4. Start coding with Tensorix!

## Using Different Models

Update `ANTHROPIC_MODEL` to switch models.

### MiniMax-M2 (Default)

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tensorix.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_TENSORIX_API_KEY>",
    "ANTHROPIC_MODEL": "minimax/minimax-m2",
    "ANTHROPIC_SMALL_FAST_MODEL": "minimax/minimax-m2",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```

### MiniMax-M2.1

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tensorix.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_TENSORIX_API_KEY>",
    "ANTHROPIC_MODEL": "minimax/minimax-m2.1",
    "ANTHROPIC_SMALL_FAST_MODEL": "minimax/minimax-m2.1",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```

### GLM-4.7

Best for tool calling and function support. See [official GLM Claude Code docs](https://docs.z.ai/scenario-example/develop-tools/claude).

```json
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.tensorix.ai/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "<YOUR_TENSORIX_API_KEY>",
    "ANTHROPIC_MODEL": "z-ai/glm-4.7",
    "ANTHROPIC_SMALL_FAST_MODEL": "z-ai/glm-4.7",
    "API_TIMEOUT_MS": "3000000",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorx.ai/documentation/claude-code-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
