Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Claude Code CLI

Claude Code is Anthropic's terminal-based coding assistant. TensorX provides an Anthropic-compatible endpoint for Claude Code and operates with zero data retention on EU-hosted infrastructure.

Prerequisites

  • Node.js 18 or newer

  • A TensorX API key (get one here)

  • Terminal access (macOS, Linux, or Windows with WSL)

Installation

Install Claude Code globally:

npm install -g @anthropic-ai/claude-code

Verify installation:

claude --version

Quick Start - No Account Required

For quick queries and scripting, use print mode which doesn't require any Anthropic account.

Choose a model ID returned by GET /v1/models, then export it with the TensorX endpoint and key:

export TENSORX_MODEL="<MODEL_ID>"
export ANTHROPIC_API_KEY="<YOUR_TENSORX_API_KEY>"
export ANTHROPIC_BASE_URL="https://api.tensorx.ai"
export ANTHROPIC_MODEL="$TENSORX_MODEL"

claude -p "Explain what a REST API is"

Print mode (-p) outputs the response and exits. For interactive development sessions with file editing and bash commands, see Interactive Mode Setup below.


Interactive Mode Setup

Interactive mode provides the full Claude Code experience with file editing, bash commands, and multi-turn conversations. Requires one-time free Anthropic account setup.

Step 1: Initial Setup (One-Time Only)

Run claude and complete the OAuth login:

Select "Anthropic Console account" when prompted and follow the browser login. A free Anthropic account works - you won't be charged by Anthropic as all requests route through TensorX.

Step 2: Configure TensorX

Create or edit ~/.claude/settings.json:

Replace <MODEL_ID> with an ID returned by GET /v1/models.

Step 3: Start Using Claude Code

Navigate to your project and run:

Why All Model Variables Are Required

Claude Code uses different models for different internal tasks:

Variable
Purpose

ANTHROPIC_MODEL

Main model for conversations

ANTHROPIC_SMALL_FAST_MODEL

Quick background tasks

ANTHROPIC_DEFAULT_HAIKU_MODEL

Token counting and small operations

ANTHROPIC_DEFAULT_SONNET_MODEL

Standard coding tasks

ANTHROPIC_DEFAULT_OPUS_MODEL

Complex reasoning tasks


Model selection

Call GET /v1/models with your TensorX API key and use one of the returned IDs. If the integration depends on a capability or token limit, query GET /v1/model/info before selecting the model. See Models for examples.


Switching Models

To switch models, update all model variables in ~/.claude/settings.json:

Replace <MODEL_ID> with your chosen TensorX model ID.

After editing, start a new Claude Code session for changes to take effect.


Troubleshooting

Anthropic model not found

Solution: You haven't set all model aliases. Ensure your settings.json includes:

  • ANTHROPIC_DEFAULT_HAIKU_MODEL

  • ANTHROPIC_DEFAULT_SONNET_MODEL

  • ANTHROPIC_DEFAULT_OPUS_MODEL

  • ANTHROPIC_SMALL_FAST_MODEL

All should be set to your chosen TensorX model.

Auth conflict warning

Message: Auth conflict: Both a token (ANTHROPIC_AUTH_TOKEN) and an API key...

Solution: This warning is normal and can be ignored. Claude Code is using your ANTHROPIC_AUTH_TOKEN from settings.json which points to TensorX. Your requests are routing correctly.

OAuth login still required after configuration

Solution: Interactive mode requires a one-time Anthropic OAuth. This is a Claude Code requirement. After completing it once, your settings.json config will route all actual API requests through TensorX.

For scripting without OAuth, use print mode: claude -p "your prompt"

Configuration not taking effect

Solution:

  1. Close all Claude Code sessions

  2. Verify ~/.claude/settings.json has correct JSON syntax

  3. Open a new terminal window

  4. Run claude again

Timeout errors

Solution: Increase API_TIMEOUT_MS in your settings.json:


FAQ

Q: Do I need an Anthropic account?

For interactive mode, yes - a free account for one-time OAuth. For print mode (-p flag), no account is needed.

Q: Will I be charged by Anthropic?

No. All API requests route through TensorX. The Anthropic OAuth is only for authentication, not billing.

Q: Why do I need to set all the model variables?

Claude Code uses different models for different internal tasks (token counting, background operations, etc.). Setting all aliases ensures everything routes to your chosen TensorX model.

Q: Can I use different models for different tasks?

Yes. Each variable can reference a different TensorX model ID.

Q: What's the difference between ANTHROPIC_API_KEY and ANTHROPIC_AUTH_TOKEN?

Both work, but ANTHROPIC_AUTH_TOKEN is preferred for custom endpoints. Use ANTHROPIC_AUTH_TOKEN in settings.json.

Q: Does TensorX support the Anthropic Messages API (/v1/messages)?

Yes. TensorX exposes an Anthropic-compatible /v1/messages endpoint at https://api.tensorx.ai, which is what Claude Code targets when you set ANTHROPIC_BASE_URL. Standard per-key rate limits apply (see Rate Limits); there is no separate endpoint to enable. For how thinking and output_config.effort map onto each model's reasoning controls, see Reasoning (api-reference/reasoning.md#messages-api-v1messages).

Q: Does Claude Code's thinking toggle turn reasoning off?

Claude Code still sends an output_config.effort when thinking is toggled off. Most models honour that effort, but on DeepSeek V4 and V4.1 any effort turns thinking on, so they still reason. See Reasoning.

Last updated

Was this helpful?