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

# Claude Code on DeepSeek V4 Pro

> How to run the whole Claude Code agent on DeepSeek V4 Pro through RuAPI: same interface, same tools, but tokens cost a fraction. Four lines of config, no proxy or router.

[Claude Code](https://docs.claude.com/en/docs/claude-code/overview) is a strong agent, but Claude tokens aren't cheap. The thing is, the agent itself isn't tied to Anthropic's models. Through RuAPI you can put it on `deepseek-v4-pro` and get the same interface, the same file edits and command runs — at DeepSeek prices. Over one real working day that comes out [about 25× cheaper](/en/deepseek-vs-claude).

Here's how it works: RuAPI accepts Claude Code's requests in Anthropic format (`/v1/messages`) and translates them into the DeepSeek format itself. To Claude Code it all looks like ordinary Claude — no proxy, no router needed.

<Note>
  This builds on the [base Claude Code setup](/en/integrations/claude-code). If Claude Code isn't installed yet, start there — this page only covers what changes for DeepSeek.
</Note>

## What you'll need

* **A RuAPI token** (`sk-...`) with a positive balance. Sign up at [www.ruapi.ai](https://www.ruapi.ai); top up in USDT — see [Top-up](/en/topup).
* **Claude Code installed** — `claude --version` should print a version number. Installation is on the [Claude Code page](/en/integrations/claude-code).

## Setup

Open `~/.claude/settings.json` (on Windows, `%USERPROFILE%\.claude\settings.json`) and add:

```json theme={null}
{
  "env": {
    "ANTHROPIC_BASE_URL": "https://www.ruapi.ai",
    "ANTHROPIC_API_KEY": "sk-your-RuAPI-token",
    "ANTHROPIC_MODEL": "deepseek-v4-pro",
    "ANTHROPIC_SMALL_FAST_MODEL": "deepseek-v4-flash"
  }
}
```

Four lines, and Claude Code runs on DeepSeek.

<AccordionGroup>
  <Accordion title="What each field does">
    | Field                        | Meaning                                                                                                       |
    | ---------------------------- | ------------------------------------------------------------------------------------------------------------- |
    | `ANTHROPIC_BASE_URL`         | RuAPI endpoint. **No** trailing `/v1`                                                                         |
    | `ANTHROPIC_API_KEY`          | Your RuAPI token (`sk-...`), not an Anthropic key                                                             |
    | `ANTHROPIC_MODEL`            | The main model. `deepseek-v4-pro` does the actual work                                                        |
    | `ANTHROPIC_SMALL_FAST_MODEL` | Model for small internal tasks (session titles, background calls). `deepseek-v4-flash` is the cheapest option |
  </Accordion>
</AccordionGroup>

<Warning>
  Don't append `/v1` to `ANTHROPIC_BASE_URL`. The Anthropic client adds `/v1/messages` itself; an extra `/v1` returns 404.
</Warning>

If you prefer environment variables or switching via CC Switch, both methods from the [base guide](/en/integrations/claude-code) work the same way — you just change the model names to `deepseek-v4-pro` and `deepseek-v4-flash`.

## First run

Open a new terminal so the settings load, and go into a project:

```bash theme={null}
cd ~/some-project
claude
```

Give it a coding task:

```
> Find where errors are handled in this project and show me that file
```

Claude Code will read files, call tools and answer — as usual. In RuAPI Console → **Logs** you'll see a fresh request with model `deepseek-v4-pro` (not Claude) and the tokens it spent — that's your confirmation it's going through DeepSeek.

## What to expect

* **Tools work.** Reading and editing files, running commands, searching the project — Claude Code's whole agent loop runs through DeepSeek.
* **Streaming** is on: the answer prints as it's generated.
* **You'll see the reasoning.** DeepSeek V4 is a reasoning model, so before answering Claude Code sometimes shows a thinking block. That's expected.

<Note>
  **DeepSeek can't read images.** Paste a screenshot into Claude Code and DeepSeek won't process it — the line has no vision. For that, switch to a vision model mid-session with `/model claude-sonnet-5`.
</Note>

## When to go back to Claude

DeepSeek V4 Pro handles almost everything, but now and then you want top quality. Without leaving the session, switch the model:

```
/model claude-sonnet-5
```

The same way gets you back to `deepseek-v4-pro`. It's convenient to keep DeepSeek as the default and bring in Claude only for the hardest spots or image tasks. One RuAPI token covers every model, with no surcharge for switching.

## How much it saves

Saving money is the whole point of the combo. For one real day of Claude Code — 405 million tokens — the bill on Claude Sonnet would be \$167; on `deepseek-v4-pro` it's about \$7. The line-by-line breakdown is in [DeepSeek vs Claude: what one day of work actually costs](/en/deepseek-vs-claude).

## Troubleshooting

<AccordionGroup>
  <Accordion title="401 / Invalid token">
    `ANTHROPIC_API_KEY` must be a RuAPI token (`sk-...`), not an Anthropic key (`sk-ant-...`). Check for stray spaces when copying, and that the token is active in Console → **Tokens**.
  </Accordion>

  <Accordion title="404 / model not found">
    Check the spelling: `deepseek-v4-pro` and `deepseek-v4-flash`. And don't append `/v1` to `ANTHROPIC_BASE_URL`.
  </Accordion>

  <Accordion title="402 / insufficient balance">
    Top up in USDT — see [Top-up](/en/topup). Tokens burn slowly on DeepSeek, but long tool-heavy sessions still spend from your balance.
  </Accordion>

  <Accordion title="Images aren't processed">
    That's by design: DeepSeek has no vision. Switch to a vision model with `/model` — see [Claude models](/en/claude-api).
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="Base Claude Code setup" icon="terminal" href="/en/integrations/claude-code">
    Install, configuration methods and provider switching.
  </Card>

  <Card title="DeepSeek vs Claude: cost of a day" icon="scale-balanced" href="/en/deepseek-vs-claude">
    A line-by-line breakdown and the 25–30× gap.
  </Card>

  <Card title="DeepSeek API" icon="microchip" href="/en/deepseek-api">
    Pro and Flash: how they differ and what they do.
  </Card>

  <Card title="Top up your balance" icon="wallet" href="/en/topup">
    USDT, networks and top-up discounts.
  </Card>
</CardGroup>
