[Blog](https://excessionlabs.ai/blog/) · 4 November 2026 · [Excession Labs](https://excessionlabs.ai/about/)

# DeepSeek in Claude Code: Excession gateway setup

Source page: https://excessionlabs.ai/blog/deepseek-claude-code/

Configure the Claude Code CLI to use DeepSeek V4.1 Flash through Excession's Anthropic-compatible endpoint. This configuration passed a local client integration test; live inference and coding tools were outside that test.

## Understand the compatibility boundary

This is a third-party compatibility setup. Anthropic's [gateway documentation](https://code.claude.com/docs/en/llm-gateway) says it does not support routing Claude Code to non-Claude models, and DeepSeek is not a Claude model. This guide does not imply Anthropic endorsement or complete Claude Code feature compatibility.

## Set the URL, key and model

Install the CLI using the [official Claude Code instructions](https://code.claude.com/docs/en/overview). Create an Excession API key in the [dashboard](https://excessionlabs.ai/app) and load it into your terminal's `EXCESSION_API_KEY` environment variable using your usual secret manager. Check your funds and current model pricing on the [API page](https://excessionlabs.ai/api).

In Bash or Zsh, run:

```
: "${EXCESSION_API_KEY:?Load your Excession API key first}"
export ANTHROPIC_BASE_URL="https://api.excessionlabs.ai"
export ANTHROPIC_AUTH_TOKEN="$EXCESSION_API_KEY"
unset ANTHROPIC_API_KEY CLAUDE_CODE_OAUTH_TOKEN

claude --safe-mode \
  --model "deepseek/deepseek-v4.1-flash-1017" \
  --tools "" \
  -p "Reply with READY."
```

The base URL is the host without `/v1`, because Claude Code appends `/v1/messages`. The `ANTHROPIC_AUTH_TOKEN` variable carries your Excession key and sends it as `Authorization: Bearer …`, as Anthropic's [gateway connection documentation](https://code.claude.com/docs/en/llm-gateway-connect) describes. These exports apply to this terminal and programs launched from it.

The smoke check disables tools with `--tools ""` and uses `--safe-mode` to keep local customizations out of the first request. A successful live run should return a short answer. Unlike our mock test, it uses metered API access on your account.

## Open an interactive session

```
claude --model "deepseek/deepseek-v4.1-flash-1017"
```

Run this in the same terminal, then use `/status` to confirm the base URL and credential source. Our fixture did not exercise reading, tool calls or edits. Test the ones you need on a disposable example before you permit project changes.

## Troubleshoot the connection

- **Authentication error:** confirm the token is an Excession key and available to this process. Never paste it into an issue or log.

- **404 or wrong endpoint:** use `https://api.excessionlabs.ai` as the base URL; appending `/v1` here can duplicate the path.

- **Wrong model:** pass the full model ID with `--model`. Built-in Claude aliases refer to other models.

- **Exports seem ignored:** inspect `/status`, settings and shell launchers. Our host had a wrapper forcing another gateway, so validation used the official executable directly.

- **Funds or rate limit error:** inspect your dashboard and API error. A mock configuration test cannot validate account entitlement.

- **Text succeeds but tools fail:** inspect non-secret request metadata and versions. Anthropic's [compatibility guide](https://code.claude.com/docs/en/llm-gateway-protocol) describes the protocol surface. A text answer does not verify every feature.

## What we tested

On 4 November 2026 we ran the actual Claude Code 2.1.318 and OpenCode 1.19.5 clients against an isolated localhost fixture with fake credentials. Each sent the exact model ID, a Bearer credential and a streaming request to its expected endpoint. Both displayed `LOCAL_FIXTURE_OK` from the fixture and exited successfully.

**This was a mock client integration test with no live DeepSeek inference.** The fixture supplied the answer, and no model generated it. The test validates configuration, request routing and text-stream parsing. It does not establish production availability, model quality, billing, long conversations, or tool-call and file-edit compatibility.

Inspect the [recorded request metadata and results](https://excessionlabs.ai/blog/evidence/deepseek-clients-2026-11-04.json) or [download the local validation script](https://excessionlabs.ai/blog/evidence/deepseek-clients-2026-11-04.py). Run the script with `--claude /path/to/claude --opencode /path/to/opencode`, using official client executables. It starts a loopback endpoint, uses fake keys and temporary client configuration, and does not read a real API key. Package setup and client startup may contact public package or model metadata services.

## Continue reading

- [DeepSeek API: Python, streaming and tool calls](https://excessionlabs.ai/blog/deepseek-api-guide/)

- [Use DeepSeek in OpenCode](https://excessionlabs.ai/blog/deepseek-opencode/)

- [Current API models and prices](https://excessionlabs.ai/api)
