---
title: "Connect Claude Code to Straitly | Straitly Docs"
description: "Set ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN to run Claude Code through Straitly with one API key and automatic provider failover."
url: https://straitly.ai/docs/claude-code
updated: 2026-11-25
publisher: Straitly (https://straitly.ai)
---

Docs

Connect your tools

# Connect Claude Code

Copy docs

**On this page**

Use your Straitly key inside Claude Code in the terminal. One paste sets it up, and the models you pick show up in Claude Code’s model menu. Works on Mac, Linux and Windows.

Terminal setup

Have ready

Claude Code installed. On Mac and Linux, python3 in your terminal. On Windows, only PowerShell, which every Windows 10 and 11 machine has. The screenshots follow macOS.

What changes

The gateway connection and model picker in \~/.claude/settings.json (on Windows, %USERPROFILE%\\.claude\\settings.json). Existing settings are backed up on the first run.

Keep copied keys and setup commands private.

### Before you start

The command in step 3 creates a key for you, or uses one you already have.

### Setup

Mac or Linux Windows

#### 1. Pick your models

These are the models you will see in Claude Code. The first one is picked when it opens.

Claude Opus 5.5× GPT-6.1 Sol× Claude Fable 5.2×

- Claude Sonnet 5.5 Anthropic · $1.20 / $6 Add
- GLM-5.3 Z.ai · $0.42 / $1.39 Add
- DeepSeek V4.1 Flash 1017 DeepSeek · $0.090 / $0.36 Add

Price per million tokens, input / output. Only models that can run Claude Code are listed.

#### 2. Open a terminal

Press **⌘ Space**, type **Terminal** and press **Enter**. Use your normal terminal, not a chat inside Claude Code.

![Spotlight search with Terminal selected](https://straitly.ai/shots/claude-code/1-terminal.webp?v=a012c851)

#### 3. Paste the command

Copy this, paste it into Terminal and press **Enter**. It keeps your other Claude Code settings. You should see `Done - Claude Code now uses Straitly`.

Copy command Show command

![Terminal after pasting the command, showing Done - Claude Code now uses Straitly](https://straitly.ai/shots/claude-code/2-done.webp?v=4f99b68d)

The command points Claude Code at `https://api.straitly.ai` with your key. A key from one Straitly site only works with the address that site prints.

#### 4. Start Claude Code

Type `claude` and press **Enter**. The first time, it asks whether you trust the folder. Choose **Yes, I trust this folder**.

![Claude Code asking whether you trust the folder, with Yes selected](https://straitly.ai/shots/claude-code/3-trust.webp?v=e4ce7126)

#### 5. Pick a model

Type `/model` and press **Enter**. Your models are listed. Move with the arrow keys and press **Enter** to choose one.

To lock one model, type `/model claude-opus-5-5` (any id from the [models page](https://straitly.ai/models)).

#### 6. Send a message

Say anything. If Claude Code answers, you are done.

![A Claude Code chat answered by Opus 5.5 through Straitly](https://straitly.ai/shots/claude-code/5-chat.webp?v=57ce573d)

### Change your models later

Pick again in step 1 and paste the new command. It replaces the list. To try one model without changing the list, type `/model` with its id, for example `/model z-ai/glm-5.3`. Every id is on the [models page](https://straitly.ai/models).

### Good to know

- **Background calls use the small model slot.** Claude Code sends small background requests, like chat titles, to its small model slot. To send them to a lighter model, run this before `claude`, or add `ANTHROPIC_DEFAULT_HAIKU_MODEL` to the `env` block in `~/.claude/settings.json`:
bash
Copy Copied Failed
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek/deepseek-v4-1-flash-1017"
- **Which model answered?** `/status` shows the model and the base URL. The [Activity page](https://straitly.ai/app/activity) shows which model answered each request.
- **Always the same model?**Check your saved instructions in the console. A saved “use only X” applies to every request.

### Verify your connection

Start Claude Code, open /model, choose one of your models, and send a short message. Confirm the request in Straitly Activity.

[Open request activity](https://straitly.ai/app/activity) to check the model, status, and charge for your test request.

### Setup checks

**python3: command not found**

Install Python 3, reopen your terminal, then run the setup command again. Paste the command in your terminal, not in a Claude Code chat. On Windows, use the Windows command, which needs no Python.

**Your model list has not changed**

Confirm the terminal printed the Done message, then exit and reopen Claude Code. Check /model again.

If the request is rejected, check your balance and key limits in [Errors & limits](https://straitly.ai/docs/errors).

### Undo

The first paste saves a copy of your old settings. To go back, run:

bash

Copy Copied Failed

cp ~/.claude/settings.json.before-straitly ~/.claude/settings.json

If you had no Claude Code settings before, delete `~/.claude/settings.json` instead.

[Connect Cursor](https://straitly.ai/docs/cursor) [Connect Claude app](https://straitly.ai/docs/claude-app)

---
Markdown version of https://straitly.ai/docs/claude-code.
